Skip to content

Commit

Permalink
Use sessionStorage for redux instead of localstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenhand committed Dec 13, 2023
1 parent 73e45e0 commit 4b71d17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugin-hrm-form/src/states/persistState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const activateStatePersistence = () => {
const {
[namespace]: { configuration, ...persistableState },
} = Manager.getInstance().store.getState() as RootState;
localStorage.setItem(
sessionStorage.setItem(
'redux-state/plugin-hrm-form',
JSON.stringify({ [pluginVersionDescription]: persistableState }),
);
Expand All @@ -40,7 +40,7 @@ export const activateStatePersistence = () => {

export const readPersistedState = (): RootState[typeof namespace] | null => {
if (getAseloFeatureFlags().enable_local_redux_persist) {
const persistedStateJson = localStorage.getItem('redux-state/plugin-hrm-form');
const persistedStateJson = sessionStorage.getItem('redux-state/plugin-hrm-form');
if (persistedStateJson) {
const persistedState = JSON.parse(persistedStateJson);
return persistedState[pluginVersionDescription];
Expand Down
4 changes: 3 additions & 1 deletion plugin-hrm-form/src/utils/setUpComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ import { TLHPaddingLeft } from '../styles/GlobalOverrides';
import { Container } from '../styles/queuesStatus';
import { FeatureFlags, isInMyBehalfITask, standaloneTaskSid } from '../types/types';
import { colors } from '../channels/colors';
import { getHrmConfig, getAseloConfigFlags } from '../hrmConfig';
import { getAseloConfigFlags, getHrmConfig } from '../hrmConfig';
import { AseloMessageInput, AseloMessageList } from '../components/AseloMessaging';
import { namespace, routingBase } from '../states/storeNamespaces';
import { changeRoute } from '../states/routing/actions';
import { ChangeRouteMode } from '../states/routing/types';
import { versionId } from '../private/secret';

type SetupObject = ReturnType<typeof getHrmConfig>;
/**
Expand Down Expand Up @@ -352,6 +353,7 @@ export const removeTaskCanvasHeaderActions = (featureFlags: FeatureFlags) => {
export const setLogo = url => {
if (url) {
Flex.MainHeader.defaultProps.logoUrl = url;
Flex.MainHeader.defaultProps.logoAltText = `Twilio Flex running Aselo (${versionId})`;
} else {
Flex.MainHeader.Content.remove('logo');
}
Expand Down

0 comments on commit 4b71d17

Please sign in to comment.