Skip to content

Commit f280477

Browse files
router query update without explicit path name
1 parent de8d708 commit f280477

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

editor/core/reducers/editor-reducer.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type {
2121
EnterIsolatedInspectionAction,
2222
ExitIsolatedInspectionAction,
2323
} from "core/actions";
24-
import { EditorState } from "core/states";
24+
import { EditorState, EssentialWorkspaceInfo } from "core/states";
2525
import { NextRouter, useRouter } from "next/router";
2626
import { CanvasStateStore } from "@code-editor/canvas/stores";
2727
import q from "@design-sdk/query";
@@ -31,8 +31,6 @@ import { nanoid } from "nanoid";
3131
import { last_page_by_mode } from "core/stores";
3232
import { track } from "@code-editor/analytics";
3333

34-
const _editor_path_name = "/files/[key]/";
35-
3634
const _DEV_CLEAR_LOG = false;
3735

3836
const clearlog = (by: string) => {
@@ -42,7 +40,10 @@ const clearlog = (by: string) => {
4240
}
4341
};
4442

45-
export function editorReducer(state: EditorState, action: Action): EditorState {
43+
export function editorReducer(
44+
state: EditorState & EssentialWorkspaceInfo,
45+
action: Action
46+
): EditorState {
4647
const router = useRouter();
4748
const filekey = state.design.key;
4849

@@ -395,10 +396,8 @@ function update_route(
395396

396397
// remove undefined fields
397398
Object.keys(q).forEach((k) => q[k] === undefined && delete q[k]);
398-
399399
router.push(
400400
{
401-
pathname: _editor_path_name,
402401
query: { ...router.query, ...q },
403402
},
404403
undefined,

0 commit comments

Comments
 (0)