Skip to content
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

refactor(reactivity): add instance check for effect #9055

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

chenfan0
Copy link
Contributor

No description provided.

@github-actions
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 85.9 kB (+14 B) 32.6 kB (+4 B) 29.5 kB (+17 B)
vue.global.prod.js 132 kB (+14 B) 49.3 kB (+4 B) 44.4 kB (+48 B)

Usages

Name Size Gzip Brotli
createApp 47.9 kB 18.8 kB 17.2 kB
createSSRApp 50.6 kB 19.9 kB 18.2 kB
defineCustomElement 50.3 kB 19.6 kB 17.9 kB
overall 61.2 kB 23.7 kB 21.6 kB

Copy link
Member

@sxzz sxzz left a comment

Choose a reason for hiding this comment

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

Could you please provide more info about your PR? Bugfixes or performance enhancement?

@sxzz sxzz added the need more info Further information is requested label Aug 31, 2023
@chenfan0
Copy link
Contributor Author

Could you please provide more info about your PR? Bugfixes or performance enhancement?

When the fn passed by the user contains the effect attribute, fn will be assigned the value fn.effect.fn. However, the existence of theeffect attribute in the fn does not necessarily mean that the effect attribute has the fn attribute. If fn is assigned the value fn.effect.fn as long as the passed fn has the effect attribute, then when the subsequent trigger is triggered, an error that fn is not a function will be reported.

const o = ref(1)
const fn = () => { o.value }
fn.effect = true
effect(fn)
o.value++  // error: fn is not a function

@sxzz
Copy link
Member

sxzz commented Aug 31, 2023

Could you please provide a reproduction?

@sxzz
Copy link
Member

sxzz commented Aug 31, 2023

/ecosystem-ci run

@sxzz sxzz removed the need more info Further information is requested label Aug 31, 2023
@vue-bot
Copy link
Contributor

vue-bot commented Aug 31, 2023

📝 Ran ecosystem CI: Open

suite result
nuxt ✅ success
pinia ✅ success
quasar ✅ success
router ✅ success
test-utils ✅ success
vant ✅ success
vite-plugin-vue ✅ success
vitepress ✅ success
vue-i18n ✅ success
vue-macros ❌ failure
vuetify ✅ success
vueuse ✅ success
vue-simple-compiler ✅ success

Copy link
Member

@sxzz sxzz left a comment

Choose a reason for hiding this comment

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

It's a not bad fix, but maybe we can make effect property as a symbol in the future. We can have more discussion.

  • symbol?
    • breaking changes?

@sxzz sxzz changed the title refactor: add instanceof check for fn.effect refactor(reactivity): add instanceof check for fn.effect Aug 31, 2023
@sxzz sxzz self-assigned this Sep 5, 2023
@sxzz sxzz merged commit e33d554 into vuejs:main Sep 5, 2023
9 checks passed
@sxzz sxzz changed the title refactor(reactivity): add instanceof check for fn.effect refactor(reactivity): add instance check for effect Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants