-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Adjust boundary error message #16748
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
base: main
Are you sure you want to change the base?
Adjust boundary error message #16748
Conversation
…undary-error-message
…s/SnippetBlock.js
/** | ||
* TODO THIS NEEDS TO ACTUALLY BE DONE | ||
* Array of `onDestroy` callbacks that should be called at the end of the server render function | ||
* @type {Function[]} | ||
*/ | ||
export let async_on_destroy = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have a separate async_on_destroy
array? why aren't we continuing to use on_destroy
exclusively, and just deferring running the callbacks until render_async
is complete?
Given that we're only assigning to async_on_destroy
at the start of render_async
, surely if you do this...
renderAsync(Component1, ...);
renderAsync(Component2, ...);
...any onDestroy
callbacks encountered in a child of Component1
after an await
will be associated with Component2
, unless Component2
happens to finish first and reset it? To be honest unless we're prepared to instrument every await
expression I don't see a way around using AsyncLocalStorage
here.
(Idle thought, we may face similar challenges around context)
packages/svelte/src/compiler/phases/2-analyze/visitors/AwaitExpression.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/compiler/phases/3-transform/server/visitors/IfBlock.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/compiler/phases/3-transform/server/visitors/IfBlock.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Rich Harris <[email protected]>
* chore: remove analysis.state.title * unused
* chore: remove is_async * unused
Co-authored-by: Rich Harris <[email protected]>
…velte into adjust-boundary-error-message
packages/svelte/src/compiler/phases/3-transform/server/visitors/EachBlock.js
Outdated
Show resolved
Hide resolved
// TODO this is probably actually broken | ||
async_on_destroy.push(...ondestroy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leaving a comment here so we don't lose track of this
// TODO more-proper error | ||
throw new Error('Encountered an asynchronous component while rendering synchronously'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint