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

Crash when using arrow functions in {@const} #7134

Closed
TheOnlyTails opened this issue Jan 13, 2022 · 2 comments · Fixed by #7144
Closed

Crash when using arrow functions in {@const} #7134

TheOnlyTails opened this issue Jan 13, 2022 · 2 comments · Fixed by #7144
Labels
bug compiler Changes relating to the compiler

Comments

@TheOnlyTails
Copy link

Describe the bug

When creating a markup variable with {@const}, whose value uses an arrow function in some way (for example, finding an item in an array), Svelte will fail with the error:

func is not defined

Reproduction

https://svelte.dev/repl/77bcccb636f64213ab20c666a870ed96

Logs

Uncaught (in promise) ReferenceError: func is not defined
    at get_each_context_3 (FeatureShowcase.svelte:210:34)
    at Array.create_if_block_13 (FeatureShowcase.svelte:209:11)
    at Object.update [as p] (FeatureShowcase.svelte:242:24)
    at update (index.mjs:1085:36)
    at flush (index.mjs:1052:13)

System Info

the command failed, but here's my system info:
- OS: Latest Windows 11 Insider build (22533.1001) in the Dev channel
- node v17.3.0
- npm v7.20.6
- Browser - Microsoft Edge 97.0.1072.55 (latest)
- Svelte 3.46.1
- SvelteKit 1.0.0-next.229

Severity

blocking an upgrade

@Conduitry Conduitry added bug compiler Changes relating to the compiler labels Jan 13, 2022
@rohitf
Copy link

rohitf commented Jan 15, 2022

@TheOnlyTails This is tangential, but you can also implement the functionality in that each block like so

{#each tags as {color}}
	<p>{color}</p>
{/each}

@TheOnlyTails
Copy link
Author

TheOnlyTails commented Jan 15, 2022

@TheOnlyTails This is tangential, but you can also implement the functionality in that each block like so

@rohitf I'm aware, this is just a demonstration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug compiler Changes relating to the compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants