-
Notifications
You must be signed in to change notification settings - Fork 16
1401 admin UI persist redux store to localstorage #1409
1401 admin UI persist redux store to localstorage #1409
Conversation
@@ -56,27 +52,6 @@ export const selectToken = (state: RootState) => selectAuth(state).token; | |||
|
|||
export const { login, logout } = authSlice.actions; | |||
|
|||
export const credentialStorage = createListenerMiddleware(); |
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.
Removed the following event listeners given the redux-perist localStorage functionality. Redux-persist localStorage root key is persist-root
.
|
||
const { connectionOption, step } = useAppSelector(selectConnectionTypeState); | ||
|
||
/** | ||
* NOTE: If the user reloads the web page via F5, the react redux store state is lost. |
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.
The following code snippet was no longer needed given the Redux store is persisted in localStorage.
@@ -65,7 +66,14 @@ const RequestTable: React.FC<RequestTableProps> = () => { | |||
isFetching, | |||
} = useRequestTable(); | |||
|
|||
return ( | |||
useEffect(() => { |
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.
This resolved a React memory leak at runtime when a user clicks the User icon to logout. Memory leak warning was visible via browser console.
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.
Only really necessary change is the excluding the API reducers from persistence.
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.
I'm not personally super familiar with this pattern, but maybe @ssangervasi can provide some more useful feedback. Otherwise, I think this looks okay, just one small thing.
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.
🏬
This was driving me crazy debugging while working on the config wizard. The persist code merged in, but the necessity of excluding these reducers was missed: ethyca/fidesops#1409 (comment) I'm actually a bit surprised ctl stuff has been working okay at all. Maye there are some bug issues I haven't seen yet.
This was driving me crazy debugging while working on the config wizard. The persist code merged in, but the necessity of excluding these reducers was missed: ethyca/fidesops#1409 (comment) I'm actually a bit surprised ctl stuff has been working okay at all. Maye there are some bug issues I haven't seen yet.
Purpose
Currently, the Admin UI Redux store is persisted in memory by default. This storage mechanism is problematic when a user reloads a browser page. Maintaining state via URL query string parameters is not a scalable solution. In order to provide a better overall user experience, the Redux store must maintain state between user page reloads.
Changes
Checklist
CHANGELOG.md
fileCHANGELOG.md
file is being appended toUnreleased
section in an appropriate category. Add a new category from the list at the top of the file if the needed one isn't already there.Run Unsafe PR Checks
label has been applied, and checks have passed, if this PR touches any external servicesTicket
Fixes #1401