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

fix(svelte): variantState should not be modified by component internal state #271

Merged
merged 1 commit into from
Oct 8, 2022

Conversation

sun0day
Copy link
Contributor

@sun0day sun0day commented Aug 26, 2022

Description

fix #264

Since Vue.watch will use Proxy to wrapper svelte component state value, once component state value changed, the global variantState changed in the same time which will make applyState useless and the watch callback not be triggered.

We can use histoire/shared.clone to cut the relation between variantState and component internal state.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • If it's a new feature, provide a convincing reason to add it. Ideally, you should open a suggestion issue first and have it approved before working on it.
  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@netlify
Copy link

netlify bot commented Aug 26, 2022

Deploy Preview for histoire-site ready!

Name Link
🔨 Latest commit 432fb2c
🔍 Latest deploy log https://app.netlify.com/sites/histoire-site/deploys/6341632f232ef5000807a9ce
😎 Deploy Preview https://deploy-preview-271--histoire-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Aug 26, 2022

Deploy Preview for histoire-controls ready!

Name Link
🔨 Latest commit 432fb2c
🔍 Latest deploy log https://app.netlify.com/sites/histoire-controls/deploys/6341632f3718230008d07541
😎 Deploy Preview https://deploy-preview-271--histoire-controls.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Aug 26, 2022

Deploy Preview for histoire-examples-vue3 ready!

Name Link
🔨 Latest commit 432fb2c
🔍 Latest deploy log https://app.netlify.com/sites/histoire-examples-vue3/deploys/6341632f7c7db700090a88db
😎 Deploy Preview https://deploy-preview-271--histoire-examples-vue3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Aug 26, 2022

Deploy Preview for histoire-examples-svelte3 ready!

Name Link
🔨 Latest commit 432fb2c
🔍 Latest deploy log https://app.netlify.com/sites/histoire-examples-svelte3/deploys/6341632f81d8e7000956710f
😎 Deploy Preview https://deploy-preview-271--histoire-examples-svelte3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@sun0day
Copy link
Contributor Author

sun0day commented Sep 1, 2022

@Akryum Can you take the time to review this pr at your convenience?

@Akryum Akryum changed the title fix: svelte variantState should not be modified by component internal state fix(svelte): variantState should not be modified by component internal state Oct 8, 2022
@Akryum Akryum merged commit af78b46 into histoire-dev:main Oct 8, 2022
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.

Control reactivity issues on first page load
2 participants