From 3fad84324026810a9006e133f884ed157c3081fb Mon Sep 17 00:00:00 2001 From: munrocket Date: Thu, 23 Nov 2023 18:01:44 +0400 Subject: [PATCH] Fix loss of original shader with fork --- components/editor/metadataeditor.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/editor/metadataeditor.tsx b/components/editor/metadataeditor.tsx index 10399560..2b0febfb 100644 --- a/components/editor/metadataeditor.tsx +++ b/components/editor/metadataeditor.tsx @@ -45,7 +45,7 @@ export const MetadataEditor = () => { const [title, setTitle] = useAtom(titleAtom); const [description, setDescription] = useAtom(descriptionAtom); const [visibility, setVisibility] = useAtom(visibilityAtom); - const shaderID = useAtomValue(shaderIDAtom); + const [shaderID, setShaderID] = useAtom(shaderIDAtom); const setShaderDataUrlThumb = useSetAtom(shaderDataUrlThumbAtom); const shadowCanvasEl = useAtomValue(shadowCanvasElAtom); const canvasEl = useAtomValue(canvasElAtom); @@ -65,7 +65,10 @@ export const MetadataEditor = () => { if (result.success) { setCodeNeedSave(false); if (result.needsRedirect) { - setTimeout(() => router.push(`/view/${result.id}`), 0); + setTimeout(() => { + setShaderID(result.id); + router.push(`/view/${result.id}`); + }, 0); } } };