Menu

1 / 4

Your Deploy Changed the App. localStorage Kept the Old Schema.

JavaScript in Plain English - Medium·Ferid Brković·about 14 hours ago
#jnDe4JoW
Reading 0:00
15s threshold

Member-only story

Your Deploy Changed the App. localStorage Kept the Old Schema.

Ferid Brković

4 min read11 hours ago

Press enter or click to view image in full size

Handle yesterday’s saved preferences without silently resetting them — or overwriting a format you don’t understand.

The new theme picker works on a clean browser. Returning users open the same release and lose their dark-mode preference.

The old app saved { "version": 1, "darkMode": true } . The new app expects { "version": 2, "theme": "dark" } .

Both objects are valid JSON. Only one matches the new code.

This is a small compatibility problem hiding inside a frontend feature. Your deploy replaced the application, but it did not replace the data already stored in someone’s browser. A successful release needs an answer for that older record.

Start with a format you can identify

localStorage stores strings for an origin and retains data across browser sessions. It does not assign a schema to your application’s values.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.