Skip to content

Commit be013c2

Browse files
committed
save submission result to notebook metadata
1 parent 7b9cba4 commit be013c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/components/LeetCodeNotebookToolbar.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ const LeetCodeNotebookToolbar: React.FC<{ notebook: NotebookPanel }> = ({
131131
cellModel.sharedModel.setSource(source);
132132
};
133133

134+
const saveResult = (
135+
result: Extract<LeetCodeSubmissionResult, { state: 'SUCCESS' }>
136+
) => {
137+
notebook.content.model?.setMetadata('leetcode_submission_result', result);
138+
};
139+
134140
// one websocket per submission
135141
useEffect(() => {
136142
if (!submissionId) {
@@ -193,6 +199,7 @@ const LeetCodeNotebookToolbar: React.FC<{ notebook: NotebookPanel }> = ({
193199
populateResultCell(resultCellModel, result);
194200
NotebookActions.changeCellType(notebook.content, 'markdown');
195201
NotebookActions.run(notebook.content);
202+
saveResult(result);
196203
notebook.context.save();
197204
}
198205
}, [result?.state]);

0 commit comments

Comments
 (0)