perf(sessions): scope preview-tab refresh to items a chat tool touched#9999
Closed
Guilhem-lm wants to merge 1 commit into
Closed
perf(sessions): scope preview-tab refresh to items a chat tool touched#9999Guilhem-lm wants to merge 1 commit into
Guilhem-lm wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying windmill with
|
| Latest commit: |
2161419
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://97ca61fd.windmill.pages.dev |
| Branch Preview URL: | https://glm-session-tab-smart-refres.windmill.pages.dev |
Contributor
Author
|
Superseded by #10006, which now carries both the scoped preview-refresh change (this PR's commit is its base) and the multi-target live-editor work as a single PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After a chat round, the sessions page reloaded preview tabs based on a broad mutating-tool name regex (
/^(write_|patch_|delete_|deploy_|discard_|set_|create_|update_|remove_)/) with a reload-all fallback: any matching tool without a resolvableargs.pathsetpendingReloadAll, blank-rebooting every preview iframe in every warm session. The frequent offender wasupdate_user_instructions(the AI's "remember this" tool — no path), so casually saving a preference rebooted every open preview.create_folderdid the same.This replaces the regex + fallback with an explicit allowlist that maps a completed tool call to the
(kind, path)of the item it touched. Item editor iframes (script/flow/app) now reload only when that exact item changed — kind-aware, so a script edit never reboots a same-path flow/app tab. Non-item list pages (runs, schedules, …) still reload on any workspace mutation, so they stay fresh. A tool that changes no workspace state (update_user_instructions) reloads nothing.The allowlist also picks up
edit_script,init_app, andrebase_draft— real mutators whose names the old regex silently missed, so they never reloaded before.No visible UI change — this only changes when preview iframes reload.
Changes
frontend/src/routes/(root)/(logged)/sessions/+page.svelte:toolReloadEffect(name, args)→{ scopes, reloadPages }: the single source of truth for what a tool reloads. Item mutations yield a(kind, path)scope; non-item workspace mutations (write_schedule/write_resource/write_variable/write_trigger/create_folder) yieldreloadPages: trueonly; everything else (incl.update_user_instructions) reloads nothing.reloadTabs(scopes, reloadPages): item-route iframes reload only when their(kind, path)is in scope; non-item page tabs reload whenreloadPages; live-editor slots still self-skip inPreviewTabHost.reload().pendingReloadAll"reload everything" fallback.Test plan
Verified in a real browser (dev server,
ai-meta-e2eworkspace) by tagging a preview iframe'scontentWindowwith a sentinel and running real chat rounds:update_user_instructions("remember I prefer dark mode") → sentinel survives (no reload). Previously reloaded every tab.write_script(draft script) → item/page reload fires (sentinel cleared).write_variable(non-item workspace mutation) → page tab reloads (sentinel cleared) — list pages stay fresh.npm run check:fastclean; sessions page + AI chat + preview panel mount with no console errors from the change.🤖 Generated with Claude Code