Skip to content

Commit 4016abf

Browse files
Copilotmatt-pharr
andcommitted
fix: run dialog logging and reduce tree flash
Co-authored-by: matt-pharr <25289941+matt-pharr@users.noreply.github.com>
1 parent 04a93fc commit 4016abf

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

electron/renderer/src/app/index.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,29 @@ const App: React.FC = () => {
215215
setScriptDialog(null);
216216

217217
try {
218+
const logEntry: LogEntry = {
219+
id:
220+
typeof crypto !== 'undefined' && 'randomUUID' in crypto
221+
? crypto.randomUUID()
222+
: `log-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
223+
timestamp: Date.now(),
224+
code: `tree.run_script("${scriptDialog.scriptPath}", **params)`,
225+
};
226+
218227
const result = await window.pdv.script.run(currentKernelId, {
219228
scriptPath: scriptDialog.scriptPath,
220229
params,
221230
});
222231

223232
if (!result.success) {
224233
setLastError(result.error);
234+
logEntry.error = result.error;
235+
} else {
236+
logEntry.result = result.result;
237+
logEntry.duration = result.duration;
225238
}
239+
setLogs((prev) => [...prev, logEntry]);
240+
setNamespaceRefreshToken((prev) => prev + 1);
226241
} catch (error) {
227242
const message = error instanceof Error ? error.message : String(error);
228243
setLastError(message);

electron/renderer/src/components/Tree/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const Tree: React.FC<TreeProps> = ({ kernelId, refreshToken = 0, onAction
2424
const expandedPathsRef = useRef<Set<string>>(new Set());
2525

2626
const loadRoot = async (force?: boolean) => {
27-
setLoading(true);
27+
setLoading(nodes.length === 0);
2828
setError(undefined);
2929
if (!kernelId) {
3030
setNodes([]);

0 commit comments

Comments
 (0)