Skip to content

Sticky note loses the last edit on unmount #377

Description

@cavidelizade

Summary

Editing a sticky note and navigating away within ~400ms loses the last keystrokes.

Where

apps/web/src/components/stickies/StickyNoteCard.tsx. The editor's onUpdate debounces persistSticky(html) by 400ms into debounceRef. The unmount cleanup only does clearTimeout(debounceRef.current), it never flushes the pending save, and there's no beforeunload flush.

Repro

Type into a note and immediately navigate away (or delete another note, or leave the stickies page) before the 400ms elapses. The last edit never reaches the server.

This is the same class as the page-editor autosave bug fixed in #322, just a different component.

Suggested fix

On cleanup, if a save timer is pending, flush it synchronously (persistSticky(editor.getHTML())) before clearing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions