-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix: catch error on @const tag in svelte:boundary in DEV mode #15369
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
Conversation
🦋 Changeset detectedLatest commit: 0ab422b 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 |
We definitely need a test for this
you can specify |
Test added. |
Should be fixed now |
|
Please wait to merge. |
…into dev/const-boundary
I think it's way better like that, since it modifies fewer files... |
I agree...much better now...let me just check a couple of things as soon as we get the actual playground |
I was trying to understand if the dev flag was needed but while exploring this I think the whole accessing eagerly const tags is not really needed. Commenting the line make no test fail... @dummdidumm you added that line here ...any insight? |
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.
Thank you
It's useful because deriveds are lazy, and by reading it eagerly in DEV to capture any |
Removing that line was not failing any test...how can you have a cannot access x before initialization in a const tag? |
@paoloricciuti You can reference something in one const tag vs the other and it can cause that issue. |
Const tags are reorganized to not have the issue and if there's some cycle it's a compiler error |
I believe that's not the case for where you reference things like snippets right? |
Oh that's it |
I'm not sure to understand the reason, but in DEV mode, the
@const
tag add a$.get()
"to eagerly evaluate the expression in order to hit any 'Cannot access x before initialization' errors"When used in a
<svelte:boundary>
, this code need to be inside the$.boundary()
.So I added
const_dev_statements
property intoSvelteBoundary
which is populated by ConstTag when his parent is aSvelteboundary
.Not sure if this need a test, neither how to test in dev mode.
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