Skip to content

Commit

Permalink
fix: update on scroll restoration (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
m99coder committed Aug 4, 2021
1 parent c141b32 commit 48f2a61
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Sticky.jsx
Expand Up @@ -304,6 +304,13 @@ class Sticky extends Component {
) {
this.props.onStateChange({ status: this.state.status });
}

// check if we are up-to-date, is triggered in case of scroll restoration
if (this.props.top !== prevState.top) {
this.updateInitialDimension();
this.update();
}

const arePropsChanged = !shallowEqual(this.props, prevProps);
if (arePropsChanged) {
// if the props for enabling are toggled, then trigger the update or reset depending on the current props
Expand Down

0 comments on commit 48f2a61

Please sign in to comment.