Skip to content

fix: webview resetting when reader settings change - #1884

Merged
rajarsheechatterjee merged 1 commit into
lnreader:masterfrom
Ecasept:fix/settings-reset
Jul 19, 2026
Merged

fix: webview resetting when reader settings change#1884
rajarsheechatterjee merged 1 commit into
lnreader:masterfrom
Ecasept:fix/settings-reset

Conversation

@Ecasept

@Ecasept Ecasept commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Previously, changing the reader state caused the whole webview to be rerendered. This resulted in buggy behavior where the TTS would restart from the beginning and scrolling progress would be reverted.

This PR fixes this by manually running Javascript inside the webview when settings change.

Improvements:

  • Changing the reader settings will not trigger a reset anymore
  • Changing the TTS settings will correctly restart the tts reader.

Implementation:

  • The reader state is stored seprately:
    • The initial state is memoized for the initial render, and subsequent changes to the settings will directly update the webview as javascript, instead of triggering a rerender
    • The parts outside of the JSX block can still use the reactive reader settings
  • The TTS now verifies that the tts settings actually changed before restarting itself

Limitations:

  • Updated custom js will not be executed until the next chapter loads due to browser limitations. I don't think this matters as you can't change custom js from the bottom sheet either way.

Fixes: #1840

@rajarsheechatterjee
rajarsheechatterjee merged commit 02b6b98 into lnreader:master Jul 19, 2026
2 checks passed
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.

Changing reader setting resets the chapter progress

2 participants