Skip to content

Commit

Permalink
Merge branch 'master' into chore/sc-28094/givefreely-modal-snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
relyks committed Jun 20, 2024
2 parents c359ea4 + 5ad689e commit e8a4a6e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions static/js/ReaderApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,14 @@ class ReaderApp extends Component {
} else {
state.panels = [];
}
this.setState(state, () => {
if (state.scrollPosition) {

// need to clone state and panels; if we don't clone them, when we run setState, it will make it so that
// this.state.panels refers to the same object as history.state.panels, which cause back button bugs
const newState = {...state};
newState.panels = newState.panels.map(panel => this.clonePanel(panel));

this.setState(newState, () => {
if (newState.scrollPosition) {
$(".content").scrollTop(event.state.scrollPosition)
.trigger("scroll");
}
Expand Down

0 comments on commit e8a4a6e

Please sign in to comment.