Skip to content

Fix memory leak in resize divider initialization#120

Merged
Yashb404 merged 4 commits into
feat/keys-freshfrom
copilot/sub-pr-116-yet-again
Feb 11, 2026
Merged

Fix memory leak in resize divider initialization#120
Yashb404 merged 4 commits into
feat/keys-freshfrom
copilot/sub-pr-116-yet-again

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 11, 2026

The setup_resize_divider() function in ViewPage was called on every effect trigger without guards, causing event listener re-registration and memory leaks.

Changes:

  • Added is_mounted signal guard to ensure one-time initialization
  • Set flag before requestAnimationFrame to prevent race condition where multiple callbacks queue before first executes
  • Follows existing pattern from create.rs

Before:

create_effect(move |_| {
    if let Some(window) = web_sys::window() {
        let callback = Closure::once(move || {
            setup_resize_divider();
        });
        window.request_animation_frame(callback.as_ref().unchecked_ref()).ok();
        callback.forget();  // Called on every effect trigger
    }
});

After:

let (is_mounted, set_mounted) = create_signal(false);

create_effect(move |_| {
    if !is_mounted.get() {
        set_mounted.set(true);  // Guard prevents redundant calls
        if let Some(window) = web_sys::window() {
            let callback = Closure::once(move || {
                setup_resize_divider();
            });
            window.request_animation_frame(callback.as_ref().unchecked_ref()).ok();
            callback.forget();
        }
    }
});

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 11, 2026 04:40
Co-authored-by: Yashb404 <139128977+Yashb404@users.noreply.github.com>
Co-authored-by: Yashb404 <139128977+Yashb404@users.noreply.github.com>
Co-authored-by: Yashb404 <139128977+Yashb404@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on secure embed authorization implementation Fix memory leak in resize divider initialization Feb 11, 2026
Copilot AI requested a review from Yashb404 February 11, 2026 04:46
@Yashb404 Yashb404 marked this pull request as ready for review February 11, 2026 04:53
@Yashb404 Yashb404 merged commit b87746a into feat/keys-fresh Feb 11, 2026
@Rakshat28 Rakshat28 deleted the copilot/sub-pr-116-yet-again branch February 12, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants