-
Notifications
You must be signed in to change notification settings - Fork 245
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
liveblocksEnhancer does not mix in LiveblocksContext to the state #1644
Comments
When I run the code from the example in the documentation, everything works, but I get the following warning from Redux (as in this issue):
I managed to work around it in this way, by creating a dummy reducer: export const store = configureStore({
reducer: {
mySlice: mySlice.reducer,
liveblocks: createSlice({
name: 'liveblocks',
initialState: {
others: [],
status: 'initial',
connection: 'authenticating',
isStorageLoading: true,
} satisfies WithLiveblocks<
Record<string, never>,
JsonObject,
BaseUserMeta
>['liveblocks'],
reducers: {},
}).reducer,
},
enhancers:
apiKey === undefined
? undefined
: (getDefaultEnhancers) =>
getDefaultEnhancers().concat(
liveblocksEnhancer({
client: createClient({
publicApiKey: apiKey,
}),
storageMapping: {
concepts: true,
conversations: true,
},
}),
),
}) In this way, I don't need to asser the type of |
What is the improvement or update you wish to see?
When you use
liveblocksEnhancer
, theliveblocks
state should be automatically mixed into the store's state.For example, given the following configuration:
liveblocks
should be present on the state. But since it's not, I get a type error when I try to access theliveblocks
state in a selector:This happens because
liveBlocksEnhancer
is declared aswhere the return type
StoreEnhancer
does not have type arguments. This means that theliveblocks
property does not get mixed into the state, and users of this library have to assert the type manually.I would expect something like:
Possibly with something else as the first type argument, for I don't know if this
liveblocksEnhancer
augments the store type.Ex. https://liveblocks.io/docs/api-reference/liveblocks-react
The text was updated successfully, but these errors were encountered: