Skip to content

Commit

Permalink
Fetch merged settings on reload (#5289)
Browse files Browse the repository at this point in the history
  • Loading branch information
srinaath committed Dec 10, 2020
1 parent 77c3527 commit 67850b8
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
filePersistenceState,
locationState,
projectMetaDataState,
settingsState,
showCreateQnAFromUrlDialogState,
} from '../atoms';
import { dispatcherState } from '../DispatcherWrapper';
Expand Down Expand Up @@ -465,8 +466,12 @@ export const projectDispatcher = () => {

/** Resets the file persistence of a project, and then reloads the bot state. */
const reloadProject = useRecoilCallback((callbackHelpers: CallbackInterface) => async (projectId: string) => {
const { snapshot } = callbackHelpers;
callbackHelpers.reset(filePersistenceState(projectId));
const { projectData, botFiles } = await fetchProjectDataById(projectId);

// Reload needs to pull the settings from the local storage persisted in the current settingsState of the project
botFiles.mergedSettings = await snapshot.getPromise(settingsState(projectId));
await initBotState(callbackHelpers, projectData, botFiles);
});

Expand Down

0 comments on commit 67850b8

Please sign in to comment.