First, move the type annotation away from the liveblocks middleware
call, and onto the create call.
Next, wrap your MyState type in a WithLiveblocks<...> wrapper. This
will make sure the injected liveblocks property on your Zustand state
will be correctly typed.
Finally, make sure to add the extra call () wrapper, needed by Zustand
v4 now:
create<WithLiveblocks<MyState,...>>()(liveblocks(...))// ^^ Not a typo
Remove the second argument to state.liveblocks.enterRoom(): it no longer
takes an explicit initial state. Instead, it's automatically be populated from
your Zustand state.
In @liveblocks/redux:
The main export has been renamed:
-import { enhancer } from "@liveblocks/redux";+import { liveblocksEnhancer } from "@liveblocks/redux";
The second argument to state.liveblocks.enterRoom() to send in an explicit
initial state is no longer supported. It will use the state in your Redux
store, for consistency and ease of use.