Skip to content

Bug: Settings reset on reload & Potential crash in utils #752

@shalini-saloni

Description

@shalini-saloni

Describe the bug

  1. SettingsContext resets settings to defaults on every page reload because it initializes state with defaults and only reads from localStorage in a useEffect, which causes settings to be overwritten.
  2. dataURItoBlob in utils.js lacks error handling for malformed data URIs, which can cause the app to crash.

To Reproduce

  1. Change settings (e.g., turn off grid).
  2. Reload page.
  3. Settings are back to default (grid is on).

Expected behavior
Settings should persist across reloads.

Proposed Fix

  • Initialize SettingsContext state lazily from localStorage to ensure settings are loaded before first render.
  • Add error handling to dataURItoBlob to handle invalid inputs gracefully.

I have a PR ready with these fixes.

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