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

Feature Request: Support for {@const} Inside <svelte:boundary> #14987

Closed
brandonbloom opened this issue Jan 12, 2025 · 0 comments · Fixed by #14993
Closed

Feature Request: Support for {@const} Inside <svelte:boundary> #14987

brandonbloom opened this issue Jan 12, 2025 · 0 comments · Fixed by #14993

Comments

@brandonbloom
Copy link

Describe the problem

I'd like to be able to write some code like this:

          {#each things as thing}
            <svelte:boundary>
              {@const x = someComplexFunction(thing)}

But I get this error:

`{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>` or `<Component>`
https://svelte.dev/e/const_tag_invalid_placementsvelte(const_tag_invalid_placement)

I generally get understand the restrictions on @const, but being able to use it inside an error boundary seems appropriate as someComplexFunction may fail.

Describe the proposed solution

It should be possible to use @const inside a svelte:boundary

Importance

would make my life easier

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 a pull request may close this issue.

1 participant