Skip to content

Converter: history panel rarely saves entries + hydration mismatch on load #20

Description

@ch-bas

Where: converter page (converter/page.tsx)

Two related problems with the "Recent conversions" feature:

  • History almost never saves. The save effect's dependency array is [sourceFramework, targetFramework] only, so entries are recorded solely when the user changes frameworks. The most common flow — paste code, read the output, leave — records nothing. (The "debounced" code comment is inaccurate; there is no debounce, just a missing dependency.) Suggested: debounce on sourceCode changes for real, e.g. save 2s after the last edit when a conversion succeeded.
  • Hydration mismatch. The useState initializer reads localStorage during hydration, so the client renders "Recent (N)" against the prerendered "Recent (0)" — a React hydration warning on every visit for anyone with saved history. Standard fix: initialize to [] and load from localStorage in a useEffect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions