-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: add infinite loop effect callstack #13231
Conversation
This adds a new dev-time only `dev_effect_stack` variable, which executed effects are pushed to and eventually cleared out after everything's settled. If it doesn't settle however, i.e. you run into an infinite loop, the last ten effects are printed out so you get an idea where the error is coming from. For proper source mapping I also had add location info to the generated effects. Closes #13192
🦋 Changeset detectedLatest commit: c046928 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
517f868
to
c046928
Compare
Do you have a screenshot what this looks like? |
Love this! |
We should probably disable this in node, as now I get this when running tests lol: stderr | packages/svelte/tests/signals/test.ts > signals > schedules rerun when writing to signal before reading it (runes mode)
Last ten effects were: [
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect]
]
stderr | packages/svelte/tests/signals/test.ts > signals > schedules rerun when writing to signal before reading it (runes mode)
Last ten effects were: [
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect],
[Function: $effect]
] |
Are these tests triggering the infinite loop guard on purpose? If not, why is this showing up? |
Just happens when you run all tests? |
5.0.0-next.244 is working great for me, performant and everything, 5.0.0-next.246 is throwing this error so I had to go back to 244. The the last ten effects are printed out but theyre all different normal things so I have no idea what to fix... |
That's weird...do you have a reproduction? |
Nevermind, I apologize, 246 works for me now. The last 10 effects don't point me to that file tho. |
This adds a new dev-time only
dev_effect_stack
variable, which executed effects are pushed to and eventually cleared out after everything's settled. If it doesn't settle however, i.e. you run into an infinite loop, the last ten effects are printed out so you get an idea where the error is coming from. For proper source mapping I also had to add location info to the generated effects.Closes #13192
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint