Skip to content

Conversation

@OrbisK
Copy link
Contributor

@OrbisK OrbisK commented Jan 31, 2026

Replacing some refs with shallowRefs

@vercel
Copy link

vercel bot commented Jan 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jan 31, 2026 11:02am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Jan 31, 2026 11:02am
npmx-lunaria Ignored Ignored Jan 31, 2026 11:02am

Request Review

Comment on lines -8 to -15
const popupEl = ref<HTMLElement | null>(null)
const popupEl = useTemplateRef('popupEl')
const popupPosition = shallowRef<{ top: number; left: number } | null>(null)

// Function ref - captures the element when popup mounts
function setPopupRef(el: unknown) {
popupEl.value = (el as HTMLElement) || null
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Flo0806 was there a reason to use a setter here? from my tests conditional useTemplateRef works fine with onClickOutside 😅

Copy link
Collaborator

Choose a reason for hiding this comment

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

I had some problems, yes. But if it works for you - perfect. Your way is the better

Copy link
Contributor Author

@OrbisK OrbisK Jan 31, 2026

Choose a reason for hiding this comment

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

If you can still reproduce the bug we might be able to fix it upstream (vueuse or vue)

Copy link
Collaborator

Choose a reason for hiding this comment

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

No... I think I had just to restart the dev server...

@danielroe
Copy link
Member

we should create an eslint rule

@danielroe danielroe added this pull request to the merge queue Jan 31, 2026
@OrbisK
Copy link
Contributor Author

OrbisK commented Jan 31, 2026

we should create an eslint rule

I also thought about this. I think we have an lint rule at vueuse that ref has to be imported as deepRef. I think this might help raise awareness.

Merged via the queue into npmx-dev:main with commit ae78188 Jan 31, 2026
13 checks passed
@OrbisK
Copy link
Contributor Author

OrbisK commented Jan 31, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants