-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add database deregistered event usage to redux #1594
Conversation
assets/js/state/databases.js
Outdated
@@ -30,6 +30,11 @@ export const databasesListSlice = createSlice({ | |||
appendDatabaseInstance: (state, action) => { | |||
state.databaseInstances = [...state.databaseInstances, action.payload]; | |||
}, | |||
removeDatabase: (state, { payload: { id } }) => { | |||
state.databases = state.databases.filter( | |||
(database) => !(database.id === id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason to use !(database.id === id)
over database.id !== id
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope... XD
Yes, i will change it to use your suggestion, it is more naturla
expect(dispatched).toContainEqual( | ||
removeDatabase({ | ||
id, | ||
sid, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like sid
is necessary for removeDatabase()
. A minor thing though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, the payload is composed with the sid
in the incoming event, so we need to put it, even though we don't use it in the reducer
Description
Listen to
datatabase_deregistered
event, it was missing.