Skip to content

Commit 2067b84

Browse files
update preview during live updates as well
1 parent 70cfe3c commit 2067b84

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/app/src/app/overmind/namespaces/live/internalActions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const initialize: AsyncAction<string, Sandbox> = async (
9393
};
9494

9595
export const initializeModuleState: Action<any> = (
96-
{ state, effects },
96+
{ state, actions, effects },
9797
moduleState
9898
) => {
9999
Object.keys(moduleState).forEach(moduleShortid => {
@@ -114,6 +114,8 @@ export const initializeModuleState: Action<any> = (
114114
}
115115
}
116116
});
117+
118+
actions.editor.internal.updatePreviewCode();
117119
};
118120

119121
export const getSelectionsForModule: Action<Module, EditorSelection[]> = (

packages/app/src/app/overmind/namespaces/live/liveMessageOperators.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export const onModuleSaved: Operator<
132132
});
133133

134134
effects.vscode.fs.writeFile(state.editor.modulesByPath, module);
135+
actions.editor.internal.updatePreviewCode();
135136
});
136137

137138
export const onModuleCreated: Operator<
@@ -151,7 +152,7 @@ export const onModuleMassCreated: Operator<
151152
modules: Module[];
152153
directories: Directory[];
153154
}>
154-
> = mutate(({ state, effects }, { _isOwnMessage, data }) => {
155+
> = mutate(({ state, actions, effects }, { _isOwnMessage, data }) => {
155156
if (_isOwnMessage) {
156157
return;
157158
}
@@ -165,14 +166,16 @@ export const onModuleMassCreated: Operator<
165166
state.editor.modulesByPath = effects.vscode.fs.create(
166167
state.editor.currentSandbox
167168
);
169+
170+
actions.editor.internal.updatePreviewCode();
168171
});
169172

170173
export const onModuleUpdated: Operator<
171174
LiveMessage<{
172175
moduleShortid: string;
173176
module: Module;
174177
}>
175-
> = mutate(({ state, effects }, { _isOwnMessage, data }) => {
178+
> = mutate(({ state, actions, effects }, { _isOwnMessage, data }) => {
176179
if (_isOwnMessage) {
177180
return;
178181
}
@@ -190,6 +193,8 @@ export const onModuleUpdated: Operator<
190193
state.editor.modulesByPath,
191194
state.editor.sandboxes[sandbox.id].modules[moduleIndex]
192195
);
196+
197+
actions.editor.internal.updatePreviewCode();
193198
});
194199

195200
export const onModuleDeleted: Operator<

0 commit comments

Comments
 (0)