Skip to content

Integration with svelte lost reactivity since version 5.24.0 #1536

@ykrods

Description

@ykrods

description

After svelte@5.24.0, even if implemented as described in https://signaldb.js.org/guides/svelte/ , items cannot be referenced correctly.

workaround is following: (Not sure if this is the proper fix, but this will work as before)

<script>
  import { Collection } from "@signaldb/core";

+ let dep = $state(0);

  const Posts = new Collection({
    reactivity: {
      create() {
-       let dep = $state(0);
        return {
          depend() {
            dep;
          },
          notify() {
            dep += 1;
          },
        };
      },
      isInScope: () => !!$effect.tracking(),
    },
  });
  let items = $state.raw([]);
  // ... 
</script>

reproduction

https://github.com/ykrods/svelte-reproduction-signaldb/tree/main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions