Skip to content

Commit b3b83e8

Browse files
committed
fix(web): address code review feedback on EditorWithExecution refactor
1 parent 8ab5e5d commit b3b83e8

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

packages/web/src/components/editor/ScriptEditorWithExecution.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,9 @@ export const ScriptEditorWithExecution: Component<ScriptEditorWithExecutionProps
2222
createEffect(
2323
on(
2424
() => props.path,
25-
(path) => {
25+
() => {
2626
observer.clearExecutions();
2727
observer.clearScriptOutput();
28-
29-
if (!path) {
30-
return;
31-
}
3228
}
3329
)
3430
);

packages/web/src/utils/createSimpleContext.ts renamed to packages/web/src/utils/createSimpleContext.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,19 @@ export function createSimpleContext<
3030
const gate = input.gate ?? true;
3131

3232
if (!gate) {
33-
return ctx.Provider({ value: init, children: props.children });
33+
return <ctx.Provider value={init}>{props.children}</ctx.Provider>;
3434
}
3535

3636
const isReady = createMemo(() => {
3737
const ready = (init as { ready?: Accessor<boolean> | boolean }).ready;
3838
return ready === undefined || (typeof ready === 'function' ? ready() : ready);
3939
});
4040

41-
return Show({
42-
when: isReady(),
43-
children: ctx.Provider({ value: init, children: props.children })
44-
});
41+
return (
42+
<Show when={isReady()}>
43+
<ctx.Provider value={init}>{props.children}</ctx.Provider>
44+
</Show>
45+
);
4546
};
4647

4748
const use = (): T => {

0 commit comments

Comments
 (0)