Skip to content

Commit

Permalink
fix: erase script content when switching threads (#164)
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Linville <[email protected]>
  • Loading branch information
g-linville authored Aug 15, 2024
1 parent 2112552 commit b2a463a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/threads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface ThreadsProps {
const Threads: React.FC<ThreadsProps> = () => {
const {
setScript,
setScriptContent,
setThread,
threads,
setScriptId,
Expand All @@ -22,6 +23,7 @@ const Threads: React.FC<ThreadsProps> = () => {
const [isCollapsed, setIsCollapsed] = useState(false);

const handleRun = async (script: string, id: string, scriptId: string) => {
setScriptContent(null);
setScript(script);
setThread(id);
setScriptId(scriptId);
Expand Down
2 changes: 2 additions & 0 deletions contexts/script.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface ScriptContextState {
subTool: string;
setSubTool: React.Dispatch<React.SetStateAction<string>>;
setScript: React.Dispatch<React.SetStateAction<string>>;
setScriptContent: React.Dispatch<React.SetStateAction<Block[] | null>>;
tool: Tool;
setTool: React.Dispatch<React.SetStateAction<Tool>>;
showForm: boolean;
Expand Down Expand Up @@ -269,6 +270,7 @@ const ScriptContextProvider: React.FC<ScriptContextProps> = ({
setScriptId,
script,
setScript,
setScriptContent,
workspace,
setWorkspace,
tool,
Expand Down

0 comments on commit b2a463a

Please sign in to comment.