-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This transitions superglue to use redux toolkit. Notable changes here include: 1. The `flash` is no longer managed by superglue. Instead, its a slice that listens to dispatched superglue events. The slice is generated automatically when you first install superglue. This is backward breaking, to add the flash back you would have to add a flash slice: ```js import { createSlice, createAction } from '@reduxjs/toolkit' import { SAVE_RESPONSE, BEFORE_VISIT} from '@thoughtbot/superglue' const saveResponse = createAction(SAVE_RESPONSE) const beforeVisit = createAction(BEFORE_VISIT) export const flashSlice = createSlice({ name: 'flash', initialState: {}, extraReducers: (builder) => { builder.addCase(beforeVisit, (state, action) => { return {} }) builder.addCase(saveResponse, (state, action) => { const { page } = action.payload; return { ...state, ...page.slices.flash } }) } }) ``` and select the state via ```js const flash = useSelector((state) => state.flash) ``` 2. Similarly, we created a `slices/pages` to more easily allow for developer customizations. This replaces the `applicationPagesReducer` in the previous `reducer.js` file. 3. We refactor the creation of the redux store into its own `store.js` file to make it more obvious for developers to customize.
- Loading branch information
Showing
27 changed files
with
131 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.