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

feat(effect): add effect to public api #909

Merged
merged 1 commit into from
Apr 3, 2020
Merged

feat(effect): add effect to public api #909

merged 1 commit into from
Apr 3, 2020

Conversation

RobbinBaauw
Copy link
Contributor

For writing custom renderers it would be nice to be able to follow a similar structure as found in the base renderer:
https://github.com/vuejs/vue-next/blob/5c33776e67a5136aca5100f8ad1b0c968527f8de/packages/runtime-core/src/renderer.ts#L1095-L1097

This would require having the effect function available to use. We can't import it from the reactivity package because of the following snippet from the readme:

This package is inlined into Global & Browser ESM builds of user-facing renderers (e.g. @vue/runtime-dom), but also published as a package that can be used standalone. The standalone build should not be used alongside a pre-bundled build of a user-facing renderer, as they will have different internal storage for reactivity connections. A user-facing renderer should re-export all APIs from this package.

This PR adds this function to the public API.

@yyx990803 yyx990803 merged commit 6fba241 into vuejs:master Apr 3, 2020
yyx990803 added a commit that referenced this pull request Apr 13, 2020
yyx990803 added a commit that referenced this pull request Apr 13, 2020
@yyx990803
Copy link
Member

This is reverted because I misread my own explanation. If you are building a user-facing renderer, you should have both @vue/reactivity and @vue/runtime-core in your dependencies, and be able to import effect from @vue/reactivity.

The sentence

The standalone build should not be used alongside a pre-bundled build of a user-facing renderer, as they will have different internal storage for reactivity connections.

only applies to the situation where:

  1. You are shipping your custom renderer with @vue/reactivity inlined;
  2. A consumer of your custom renderer decides to install @vue/reactivity as a standalone dependency and import effect from it.

Which should be really rare, since end users of custom renderers shouldn't need effect. Or, if you think your users would need it, you can export effect from your custom renderer.

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