-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
refactor(runtime-core): check feature flag when forwarding data
properties
#13966
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
WalkthroughAdds FEATURE_OPTIONS_API guards to data-related branches in PublicInstanceProxyHandlers within componentPublicInstance.ts, conditioning get, set, and has behavior on the options API feature flag. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User as User Code
participant Proxy as PublicInstanceProxyHandlers
participant Inst as Component Instance
participant Data as instance.data
participant Flag as __FEATURE_OPTIONS_API__
rect rgb(245,248,255)
note over User,Proxy: Property read (get)
User->>Proxy: access key
Proxy->>Flag: check enabled?
alt Flag enabled AND key in Data
Proxy->>Data: return Data[key]
else
Proxy->>Inst: fallback to other sources
end
end
rect rgb(245,255,245)
note over User,Proxy: Property write (set)
User->>Proxy: set key = value
Proxy->>Flag: check enabled?
alt Flag enabled AND key in Data
Proxy->>Data: Data[key] = value
Proxy-->>User: true
else
Proxy->>Inst: other mutation paths
end
end
rect rgb(255,248,245)
note over User,Proxy: Existence check (has)
User->>Proxy: "key" in proxy
Proxy->>Flag: check enabled?
alt Flag enabled AND key in Data AND not startsWith("$")
Proxy-->>User: true
else
Proxy->>Inst: check other sources
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)packages/runtime-core/src/componentPublicInstance.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (3)
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. Comment |
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: |
This is a minor refactoring that adds
__FEATURE_OPTIONS_API__
to places wherePublicInstanceProxyHandlers
usesdata
. For builds using__VUE_OPTIONS_API__: false
this should allow the code to be removed from production builds.Usages of
data
inside dev-only code haven't been changed and shouldn't be impacted.This is a small part of a larger refactoring I'm attempting, which also includes #13507 and #13514. That should eventually allow the
switch
/case
logic to be replaced. For now, the usage ofdata
inside theswitch
is retained as there isn't a convenient way to remove it.Summary by CodeRabbit