generated from react18-tools/turborepo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Describe the bug
Using [email protected] and using the README examples it didn't work.
To Reproduce
using it just like the README example:
import { create } from "zustand";
import { syncTabs } from "zustand-sync-tabs";
type MyStore = {
count: number;
set: (n: number) => void;
};
export const useStore = create<MyStore>(
syncTabs(
set => ({
count: 0,
set: n => set({ count: n }),
}),
{ name: "my-channel" },
),
);
//example.tsx
function Example() {
return (
<>
<>Count: {useStore((s) => s.count)}</>
<button
onClick={() => {
useStore.setState({ count: useStore.getState().count + 1 });
}}
>
Add
</button>
</>
);
}
and opening 2 tabs in nextjs v14.2.28 and clicking the "Add" button won't update the count in the other tab (also no error happens)
the same example tested with library: [email protected]
and works properly
- OS: Ubuntu 22
- Browser: Chrome Version 133.0.6943.98 (Official Build) (64-bit)
Metadata
Metadata
Assignees
Labels
No labels