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

Page subscribe only works once after introducing $app/state #13200

Open
ciscoheat opened this issue Dec 19, 2024 · 0 comments · May be fixed by #13205
Open

Page subscribe only works once after introducing $app/state #13200

ciscoheat opened this issue Dec 19, 2024 · 0 comments · May be fixed by #13205
Labels
bug Something isn't working

Comments

@ciscoheat
Copy link

Describe the bug

When the $app/state module was added, a regression happened in $app/stores, breaking subscribing to the old page store there. This is the gist:

import { page } from '$app/stores';
page.subscribe((page) => console.log('Page update'));

This only works once if you have a callback on use:enhance and submits a form. After submitting the form multiple times, the subscribe callback isn't triggered.

<form method="POST" use:enhance={() => {
  // If adding use:enhance without this callback, it works
  return async ({ result }) => {
    await applyAction(result);
  };
}}
>
  <button>Submit</button>
</form>

Reproduction

https://github.com/ciscoheat/apply-action-problem

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 42.93 GB / 63.93 GB
  Binaries:
    Node: 22.8.0 - C:\Program Files\nodejs\node.EXE       
    Yarn: 1.22.22 - ~\AppData\Local\pnpm\yarn.CMD
    npm: 9.3.1 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.15.0 - ~\AppData\Local\pnpm\pnpm.CMD
    bun: 1.0.32 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    @sveltejs/adapter-auto: ^3.3.1 => 3.3.1
    @sveltejs/kit: ^2.12.2 => 2.12.2
    @sveltejs/vite-plugin-svelte: ^5.0.3 => 5.0.3
    svelte: ^5.14.4 => 5.14.4
    vite: ^6.0.3 => 6.0.3

Severity

blocking an upgrade

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants