-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
I can reference properties from a store like this in my template code:
$engagementsContext.sortedBy
$engagementsContext.toggleSort
$engagementsContext.sortActionTitle
$engagementsContext.sortIcon
$engagementsContext.sortedByInverse
…but if I first try to destructure those properties using {@const}, I get this error:
ReferenceFrror: sortedBy is not defined at Array.create_after_title_slot (and so on)
** My hunch is this has to do with the `{@const being considered part of the default slot of its parent's component, while I'm technically trying to use its destructured values in another slot.
Addtl referential screenshots
| Working code sample (w/o destructuring) | Broken code screenshot (w/ destructuring) | Resulting error |
|---|---|---|
![]() |
![]() |
![]() |
Reproduction
- Basic reproduction: https://svelte.dev/repl/102dbd6fe6bc441180fa59d8fd2e2c03?version=3.59.1
- Attempted workaround: https://svelte.dev/repl/717d0debe4464481aa9280bbbe0d5708?version=3.59.1
- Attempted workaround #2: https://svelte.dev/repl/ace70bae29574258847f64e4d033bdd0?version=3.59.1
☝🏼 this one actually works and appears to confirm my above hunch
Logs
[HMR][Svelte] Failed to rerender <+page>
ReferenceError: sortedBy is not defined
at Array.create_after_title_slot (https://dev.carevoyance.com:5001/src/routes/app/(:5001/app/field/providers/search)/field/providers/[providerId]/+page.svelte?t=1684125015357:1729:17)
at create_slot (index.mjs:71:28)
at fallback_block_2 (MiniDossierSection.svelte:68:53)
at create_if_block_4 (MiniDossierSection.svelte:68:53)
at create_if_block_1 (MiniDossierSection.svelte:69:22)
at create_fragment (MiniDossierSection.svelte:67:19)
at init (index.mjs:2113:37)
at new MiniDossierSection (MiniDossierSection.svelte:50:21)
at createProxiedComponent (svelte-hooks.js?v=ddc96c07:341:9)
at new ProxyComponent (proxy.js?v=ddc96c07:242:7)
System Info
System:
OS: macOS 13.1
CPU: (10) arm64 Apple M1 Pro
Memory: 535.67 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm
Browsers:
Chrome: 113.0.5672.92
Chrome Canary: 115.0.5771.0
Firefox: 112.0.2
Firefox Nightly: 111.0a1
Safari: 16.2
Safari Technology Preview: 16.4
npmPackages:
svelte: ~3.57.0 => 3.57.0
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels


