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: ensure SvelteDate cached methods have correct reactive context #14525

Merged
merged 7 commits into from
Dec 3, 2024

Conversation

Rich-Harris
Copy link
Member

alternative to #14512 — instead of using the nearest parent effect, we use whichever reaction was active when the instance was created

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

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Copy link

changeset-bot bot commented Dec 3, 2024

🦋 Changeset detected

Latest commit: 8d59b02

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Dec 3, 2024

Playground

pnpm add https://pkg.pr.new/svelte@14525

@Rich-Harris
Copy link
Member Author

preview: https://svelte-dev-git-preview-svelte-14525-svelte.vercel.app/

this is an automated message

…ed.js

Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
@trueadm trueadm merged commit 2f8eda9 into main Dec 3, 2024
11 checks passed
@trueadm trueadm deleted the date-fix-alt branch December 3, 2024 18:50
@github-actions github-actions bot mentioned this pull request Dec 3, 2024
@simeydotme
Copy link
Contributor

Not sure if anyone will see this, but this change has caused a rather severe performance bug in my library, not sure if this affects anyone else but it could be considered breaking as the REPL basically dies if the console is closed (infinite loop, it seems like)

I'm sure there must be something I'm doing that is unorthodox but from version 3.0.0, up until version 5.5.2 there was no such issue. If anyone knows how to resolve, please let me know ... otherwise if I figure it out I'll drop the answer back in here. 🙏

@paoloricciuti
Copy link
Member

Could it be something in 5.5.1?

#14529

If i have to guess this is the culprit: #14192

you are probably doing a lot of this and so it's constantly logging the warning?

@simeydotme
Copy link
Contributor

Could it be something in 5.5.1?

#14529

If i have to guess this is the culprit: #14192

you are probably doing a lot of this and so it's constantly logging the warning?

ah, it could be!
I saw this, also, which appears adjacent; #14643

I think based on your comment and the commit you shared, it is possibly because I have a $: statement being updated by a spring-store result 🤔 ... (imagine I'm not the only one) but after thinking about it, perhaps that's a code smell and I should try to refactor that to use the subscribe method for reassignment instead (possibly with a rAF() debouncer.

Thanks @paoloricciuti this gives me a nice direction to follow up 🙏

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.

4 participants