Skip to content

Commit 6d45275

Browse files
committed
Document why the editor mount is load-order-safe
1 parent 7b000a6 commit 6d45275

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -912,9 +912,11 @@ fn JsonEditor(
912912
textarea_ref: NodeRef<html::Textarea>,
913913
initial_value: String,
914914
) -> impl IntoView {
915-
// Mount needs both the editor div and the textarea loaded, and their load
916-
// order isn't guaranteed, so drive it off both `on_load`s and fire on
917-
// whichever lands last (the guard makes the other a no-op).
915+
// Mount needs both the editor div and the textarea. The div is DOM-ordered
916+
// after the textarea, so the div's `on_load` alone would suffice; both are
917+
// wired so the mount fires on whichever ref lands last (`on_load` is
918+
// effect-based and fires even for a ref already loaded when registered),
919+
// and the guard makes the redundant call a no-op.
918920
let mounted = StoredValue::new(false);
919921
let init = StoredValue::new(initial_value);
920922
let try_mount = move || {

0 commit comments

Comments
 (0)