Skip to content

Commit

Permalink
fix: Ensure flowId is populated on settings routes
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Sep 23, 2024
1 parent b6c2b72 commit e9c70e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface SharedStore extends Store.Store {
flowName: string;
flowAnalyticsLink: string | null;
id: string;
setFlowId: (id: string) => void;
getNode: (id: NodeId) => Store.Node | undefined;
resetPreview: () => void;
setFlow: ({
Expand Down Expand Up @@ -63,6 +64,9 @@ export const sharedStore: StateCreator<
flowAnalyticsLink: null,

id: "",

setFlowId: (id) => set({ id }),

previewEnvironment: "standalone",

setPreviewEnvironment(previewEnvironment: PreviewEnvironment) {
Expand Down
3 changes: 2 additions & 1 deletion editor.planx.uk/src/routes/serviceSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface GetFlowSettings {
export const getFlowSettings = async (req: NaviRequest) => {
const {
data: {
flows: [{ settings, status }],
flows: [{ id, settings, status }],
},
} = await client.query<GetFlowSettings>({
query: gql`
Expand All @@ -40,6 +40,7 @@ export const getFlowSettings = async (req: NaviRequest) => {
},
});

useStore.getState().setFlowId(id);
useStore.getState().setFlowSettings(settings);
useStore.getState().setFlowStatus(status);
};
Expand Down

0 comments on commit e9c70e3

Please sign in to comment.