Skip to content

Commit a518cfa

Browse files
committed
A skeleton loading experiment
1 parent 72dbe96 commit a518cfa

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

packages/app/src/app/overmind/namespaces/editor/actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export const sandboxChanged: AsyncAction<{ id: string }> = withLoadApp<{
8686

8787
state.editor.isLoading = !hasExistingSandbox;
8888
state.editor.notFound = false;
89+
state.editor.currentId = newId;
8990

9091
try {
9192
const sandbox = await effects.api.getSandbox(newId);

packages/app/src/app/overmind/namespaces/editor/state.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,25 @@ export const state: State = {
120120
devToolIndex: 0,
121121
tabPosition: 0,
122122
},
123-
currentSandbox: ({ sandboxes, currentId }) => sandboxes[currentId],
123+
currentSandbox: ({ sandboxes, currentId }) => {
124+
if (!currentId) {
125+
return undefined;
126+
}
127+
128+
if (sandboxes[currentId]) {
129+
return sandboxes[currentId];
130+
}
131+
132+
return {
133+
id: currentId,
134+
alias: '',
135+
title: '',
136+
description: '',
137+
modules: [],
138+
directories: [],
139+
privacy: 0,
140+
};
141+
},
124142
isAllModulesSynced: ({ changedModuleShortids }) =>
125143
!changedModuleShortids.length,
126144
currentModule: ({ currentSandbox, currentModuleShortid }) =>

packages/app/src/app/pages/Sandbox/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const Sandbox: React.FC<Props> = ({ match }) => {
115115
return <NotFound />;
116116
}
117117

118-
if (state.editor.isLoading || !state.editor.currentSandbox) {
118+
if (!state.editor.currentId) {
119119
return (
120120
<>
121121
<Skeleton

0 commit comments

Comments
 (0)