Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

refactor(vue): replace getCurrentInstance with utility functions#71

Merged
johnleider merged 4 commits intomasterfrom
feat/instance-checker
Jan 5, 2026
Merged

refactor(vue): replace getCurrentInstance with utility functions#71
johnleider merged 4 commits intomasterfrom
feat/instance-checker

Conversation

@AndreyYolkin
Copy link
Contributor

Vue 3.6 comes wtih a different util for getting a generic component instance, which results in getCurrentInstance being nullish for мapor components (see https://github.com/vuejs/core/releases/tag/v3.6.0-beta.1)

Since the codebase doesn't have a unified way to check existing instance without unneeded warnings on dev (such as getContext) we need to have a wrapper for that
This PR introduced 2 internal methods to get check instance and get its name universally (tested on 3.5.24 and 3.6.0-beta.1)

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 30, 2025

Open in StackBlitz

commit: 234e851


return toKebabCase(vm?.name?.replace('V0', '') ?? '')
const name = instanceName()
if (!name) return ''
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this early return could save a lot of unneeded toKebabCase calls. Tried with 50% undefined names, received 50% ops/sec improvement

@AndreyYolkin AndreyYolkin marked this pull request as draft December 30, 2025 01:05
@AndreyYolkin AndreyYolkin self-assigned this Dec 30, 2025
@AndreyYolkin AndreyYolkin marked this pull request as ready for review December 30, 2025 12:14
@johnleider johnleider added this to the v0.1.0 milestone Jan 1, 2026
@johnleider johnleider merged commit c933029 into master Jan 5, 2026
11 checks passed
@johnleider johnleider deleted the feat/instance-checker branch January 5, 2026 14:47
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.

2 participants