Skip to content

refactor: migrate observer composables to @vuetify/v0#22672

Merged
johnleider merged 14 commits intonextfrom
feat/v0-observer-composables
Mar 10, 2026
Merged

refactor: migrate observer composables to @vuetify/v0#22672
johnleider merged 14 commits intonextfrom
feat/v0-observer-composables

Conversation

@johnleider
Copy link
Member

@johnleider johnleider commented Mar 3, 2026

Summary

  • Replace internal useIntersectionObserver, useResizeObserver, and useMutationObserver with useElementIntersection, useElementSize, and useResizeObserver from @vuetify/v0@^0.1.5
  • Remove 3 composables, 2 test files, and the @types/resize-observer-browser dev dependency
  • Move MutationOptions interface inline into directives/mutate/index.ts
  • Fix Marquee.vue to use useTemplateRef for element refs
  • Add @vuetify/v0 to minimumReleaseAgeExclude in pnpm-workspace.yaml

Components updated

  • VInfiniteScrolluseElementIntersection
  • VOtpInputuseElementIntersection
  • VParallaxuseElementIntersection + useElementSize
  • VProgressCircularuseElementIntersection + useElementSize
  • VProgressLinearuseElementIntersection + useResizeObserver
  • VSlideGroupuseElementSize
  • VColorPickeruseResizeObserver
  • VFabuseResizeObserver
  • VFooteruseResizeObserver
  • VPaginationuseResizeObserver
  • VSnackbarQueueuseElementSize
  • VVirtualScrollItemuseResizeObserver

Composables updated

  • layout.tsuseElementSize (replaces useResizeObserver)
    • Not actually used for anything
  • virtual.tsuseElementSize (replaces useResizeObserver)

Test plan

  • pnpm test passes (only pre-existing date adapter failures remain)
  • pnpm lint:fix and typecheck pass
  • No ResizeObserver errors in browser tests
  • Manual verification of VParallax scroll behavior
  • Manual verification of VProgressCircular size detection

ShallowRef<HTMLElement | null> is not assignable to MaybeRef<Element | null | undefined>
due to [RefSymbol] branding incompatibility between @vue/reactivity 3.5.24 (v0) and 3.5.25 (vuetify).
Also migrates Marquee.vue from deleted resizeObserver composable to native ResizeObserver.
Replace internal useIntersectionObserver, useResizeObserver, and
useMutationObserver with useElementIntersection and useElementSize
from @vuetify/v0. Removes 3 composables, 2 test files, and the
@types/resize-observer-browser dev dependency.

Components updated: VInfiniteScroll, VOtpInput, VParallax,
VProgressCircular. Composables updated: layout, virtual.
v0@0.1.5 uses structural MaybeElementRef types that accept
cross-version Vue refs without casts. Remove all 18 as any casts
from useElementSize, useElementIntersection, and useResizeObserver
call sites.
Fixes CI typecheck error where shallowRef<HTMLElement | null> is not
assignable to VNodeRef in template :ref bindings.
@johnleider johnleider requested a review from a team March 3, 2026 19:18
@johnleider johnleider self-assigned this Mar 3, 2026
@johnleider johnleider added this to the v5.0.0 (Tardis) milestone Mar 3, 2026
@johnleider johnleider added the T: feature A new feature label Mar 3, 2026
@J-Sek

This comment was marked as resolved.

KaelWD added 4 commits March 4, 2026 18:49
- if you need `as any` you're doing it wrong
- `ref<foo | null>(null)` can just be `ref<foo>()`
- `watch(() => ref.value)` can just be `watch(ref)`
@KaelWD KaelWD changed the title feat: migrate observer composables to @vuetify/v0 refactor: migrate observer composables to @vuetify/v0 Mar 4, 2026
J-Sek
J-Sek previously approved these changes Mar 4, 2026
@johnleider johnleider merged commit ec2fdbd into next Mar 10, 2026
16 checks passed
@johnleider johnleider deleted the feat/v0-observer-composables branch March 10, 2026 18:12
const { isIntersecting } = useElementIntersection(el)

watch(isIntersecting, async val => {
watch(() => isIntersecting.value, async val => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the problem with this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T: feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants