CodingNic

Personalize the Reading Experience

Persist Settings Across Sessions

Personalize the Reading Experience 18 min read

Persist Settings Across Sessions

Persist Settings Across Sessions

Task

Save Reader preference changes to the API and restore them when the Reader opens.

Debounce rapid setting changes so dragging or repeated clicks does not create unnecessary requests.

After loading preferences:

ts
setPreferences(preference);
applyPreferences(preference);

After a change:

ts
setPreferences(next);
applyPreferences(next);
savePreferences(next);

Keep the local UI responsive while persistence happens in the background.

Test

Change several Reader settings, close the Reader, sign out, sign back in, and reopen a Book.

The settings should be restored for the same account.

A different account should receive its own defaults.

Checkpoint

Reader preferences persist per user across sessions.