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: address runtime effect issues #9417

Merged
merged 7 commits into from
Nov 13, 2023
Merged

fix: address runtime effect issues #9417

merged 7 commits into from
Nov 13, 2023

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Nov 13, 2023

This PR addresses several issues relating to the runtime:

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

  • 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.

Tests and linting

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

Copy link

changeset-bot bot commented Nov 13, 2023

🦋 Changeset detected

Latest commit: 8ea82ee

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

vercel bot commented Nov 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-5-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 3:42pm

Copy link
Member

@dummdidumm dummdidumm 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 add a changeset?

$effect(() => {
let double = $derived(count * 2)

log.push('init ' + double);
Copy link
Member

Choose a reason for hiding this comment

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

I think this test can move into tests/signals - or do we need something Svelte-render-specific here? Seems purely related to the signals runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It matches the other tests inside the directory that checks logging order? It seems related to Svelte runtime too.

Copy link
Member

Choose a reason for hiding this comment

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

Which other tests are you talking about? Maybe those other tests need to move into tests/signals, too 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried, but I now get test failures accessing component. Let's leave them for now and address in another PR.

Copy link
Member

Choose a reason for hiding this comment

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

what test failures about accessing component? When you try to turn this test into a test in signals then it fails or what do you mean exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test suite setup is different I guess?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I've done some digging and ultimately I don't think these are signals tests and they shouldn't be coupled with being so. Signal tests should be agnostic of Svelte's components. However, these cases come from bug reports where users have created components that demonstrate ordering issues or timing issues that are relevant to their components. This is important as the signals tests also demonstrate unowned signals – which mean they are independent of components too, not to mention how this all fits into equality.

Let's merge this PR and create a separate issue on how we can unify the semantics around signals - vs - component state semantics, as I think there needs to be a distinction and having one is important. For example, our current signals tests are all wrapped with a render effect, which is likely wrong too. They shouldn't be, signals should be agnostic of effects.

Copy link
Member

Choose a reason for hiding this comment

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

The idea of wrapping them is to simulate this being run inside a component context, which is why I was so confused why it wouldn't work when having them in that test suite

@Rich-Harris Rich-Harris merged commit 17e6c4f into main Nov 13, 2023
7 of 8 checks passed
@Rich-Harris Rich-Harris deleted the fix-runtime-bugs branch November 13, 2023 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants