Skip to content

Commit

Permalink
Fix: initial load on customize page, move to empty modeling page
Browse files Browse the repository at this point in the history
View store doesnt FETCH_VIEW, which does a router push, on customize page.
When we load the modeling workspace, find this state and call FETCH_VIEW
  • Loading branch information
jobelenus committed Dec 20, 2024
1 parent 6910be4 commit 1f7f1e1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions app/web/src/components/ModelingDiagram/ModelingDiagram.vue
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ import { ComponentType } from "@/api/sdf/dal/schema";
import { useStatusStore } from "@/store/status.store";
import { useQualificationsStore } from "@/store/qualifications.store";
import { nonNullable } from "@/utils/typescriptLinter";
import { ViewId } from "@/api/sdf/dal/views";
import { useFeatureFlagsStore } from "@/store/feature_flags.store";
import { DefaultMap } from "@/utils/defaultmap";
import DiagramGridBackground from "./DiagramGridBackground.vue";
Expand Down Expand Up @@ -392,7 +391,6 @@ const ZOOM_PAN_FACTOR = 0.5;

const props = defineProps<{
cursors?: DiagramCursorDef[];
viewId: ViewId | undefined;
readOnly?: boolean;
}>();

Expand Down
3 changes: 2 additions & 1 deletion app/web/src/components/Workspace/WorkspaceModelAndView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
<ModelingDiagram
v-else
ref="diagramRef"
:viewId="viewId"
@mouseout="presenceStore.clearCursor"
@right-click-element="onRightClickElement"
@close-right-click-menu="closeRightClickMenu"
Expand Down Expand Up @@ -212,6 +211,8 @@ const onKeyDown = async (e: KeyboardEvent) => {
onMounted(() => {
window.addEventListener("keydown", onKeyDown);
statusStore.FETCH_DVU_ROOTS();
if (!viewStore.selectedViewId && !viewStore.activatedAndFetched)
viewStore.FETCH_VIEW(viewId.value);
});

onBeforeUnmount(() => {
Expand Down
2 changes: 2 additions & 0 deletions app/web/src/store/views.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
changeSetId,
defineStore(`ws${workspaceId || "NONE"}/cs${changeSetId || "NONE"}/views`, {
state: () => ({
activatedAndFetched: false,
selectedViewId: null as ViewId | null,
outlinerViewId: null as ViewId | null,
recentViews: new UniqueStack() as UniqueStack<ViewId>,
Expand Down Expand Up @@ -1590,6 +1591,7 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
route?.name as string,
)
) {
this.activatedAndFetched = true;
if (route?.params.viewId) viewId = route.params.viewId as string;
await this.FETCH_VIEW(viewId);
// ^ selects the view
Expand Down

0 comments on commit 1f7f1e1

Please sign in to comment.