-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
fix(runtime-core): improve consistency of PublicInstanceProxyHandlers.has
#13507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes update the logic of the component proxy's "has" trap to refine how properties are checked for existence, particularly handling Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Test Suite
participant Proxy as Component Proxy
participant Data as data
participant Computed as computed
participant Type as component type (__cssModules)
participant Global as globalProperties
Test->>Proxy: "key" in proxy
alt key exists in setupState, data (not $-prefixed), props, attrs
Proxy-->>Test: true
else key exists in computed, globalProperties
Proxy-->>Test: true
else key exists in type.__cssModules
Proxy-->>Test: true
else
Proxy-->>Test: false
end
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms (4)
🔇 Additional comments (9)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
While working on a larger refactor I noticed some small inconsistencies between the
get
andhas
handlers forPublicInstanceProxyHandlers
. This PR tries to makehas
consistent withget
.In particular:
data
that begin with$
are not proxied through the instance. Thehas
handler was not taking that into account. Example.__cssModules
. Thehas
handler wasn't considering these.I've also added tests for a handful of other related cases, mostly involving the use of the
$
prefix.A few notes...
props
andsetup
show warnings when creating properties that begin with$
, so I haven't attempted to 'fix' those._
is currently unclear. Butget
andhas
both handle it the same way, so I haven't changed that.key[0]
, which assumes thekey
is astring
. It could also be asymbol
, but it will still work correctly and this is consistent with how it is handled in theget
handler.hasOwn
. Maybe it should be, but I was just aiming for consistency withget
.I'm hoping to open another PR in the near future that refactors this code further to allow
get
andhas
to share more code, but I wanted to get this fixed first.Summary by CodeRabbit