Skip to content

Adding localStorage to presist the prompt input evenafter the hard re…#27

Open
gobinathvaratharajan wants to merge 1 commit intofreestyle-sh:mainfrom
gobinathvaratharajan:feature-prompt-local-storage
Open

Adding localStorage to presist the prompt input evenafter the hard re…#27
gobinathvaratharajan wants to merge 1 commit intofreestyle-sh:mainfrom
gobinathvaratharajan:feature-prompt-local-storage

Conversation

@gobinathvaratharajan
Copy link

@gobinathvaratharajan gobinathvaratharajan commented Dec 7, 2025

Adding the hard refresh to the prompt input field

Screen.Recording.2025-12-07.at.12.46.59.PM.mov

TL;DR

Persisted the prompt input to localStorage to prevent text from being lost on a hard refresh.

Screen.Recording.2025-12-07.at.12.46.59.PM.mov

Why we made these changes

To improve the user experience by ensuring that text typed into the prompt input is not lost during an accidental page reload or navigation.

What changed?

  • The prompt input component now saves its value to localStorage whenever the user types.
  • When the component loads, it checks localStorage for a saved prompt and restores it to the input field.

Validation

  • Verify that text entered in the prompt input persists after a hard refresh.
  • Verify that the input field is cleared after a prompt is submitted.
  • Verify that localStorage is cleared after submission.

Description generated by Mesa. Update settings

Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performed full review of 74316d1...99f0054

Analysis

  1. SSR/CSR Hydration Mismatch: The implementation doesn't handle the server-side rendering cycle properly, causing potential hydration errors when localStorage values differ from initial server-rendered state.

  2. No Error Handling or Safety Checks: Direct localStorage access without proper error handling creates fragility in environments where storage is unavailable (private browsing, quota exceeded, SSR).

  3. Performance Issue: Writing to localStorage on every keystroke creates unnecessary I/O overhead that could impact typing performance, especially on lower-end devices.

  4. Architectural Fragmentation: Multiple useEffect hooks handling related functionality should be consolidated into a more robust abstraction like a custom hook or storage utility.

Tip

Help

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

1 files reviewed | 1 comments | Edit Agent SettingsRead Docs

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.

1 participant