Skip to content

Commit ba05ff9

Browse files
committed
Keep commit-dialog metadata editor mounted across live-validation refetches
The live-validation LocalResource is read inside the Commit page's Suspense boundary, so each debounced refetch re-armed the boundary's pending set and a plain Suspense unmounted the whole CommitContent subtree (including the JSON editor container) to show its fallback, detaching the editor's DOM and blurring it on every keystroke. Switch the boundary to Transition so it keeps the already-rendered children mounted while later resource loads are pending; the editor now mounts once per dialog open and keeps focus through validation round-trips. Initial load still shows the spinner fallback once.
1 parent 4b077d1 commit ba05ff9

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

quilt-sync/ui/src/pages/commit.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,19 @@ pub fn Commit() -> impl IntoView {
3333
async move { commands::get_commit_data(namespace).await }
3434
});
3535

36+
// A `Transition` (not `Suspense`) is deliberate: the live-validation
37+
// `LocalResource` in `CommitContent` is read (via `live_violations`) inside
38+
// this boundary's reactive scope, so reading it registers the resource with
39+
// this boundary's `SuspenseContext` — and every debounced refetch re-arms
40+
// that pending set. Under a plain `Suspense` the re-armed pending state flips
41+
// the boundary back to its fallback, which unmounts the whole `CommitContent`
42+
// subtree — including the JSON editor's container `<div>` — detaching it from
43+
// the DOM and blurring the metadata editor on every keystroke. `Transition`
44+
// keeps the already-rendered children mounted while later resource loads are
45+
// pending (it only shows the fallback on the initial load), so the editor is
46+
// mounted once per dialog open and validation round-trips never touch its DOM.
3647
view! {
37-
<Suspense fallback=move || {
48+
<Transition fallback=move || {
3849
view! {
3950
<Layout breadcrumbs=vec![] notification=notification ui_locked=ui_locked>
4051
<Spinner />
@@ -73,7 +84,7 @@ pub fn Commit() -> impl IntoView {
7384
}
7485
}
7586
})}
76-
</Suspense>
87+
</Transition>
7788
}
7889
}
7990

0 commit comments

Comments
 (0)