Skip to content

Commit 48f2a61

Browse files
authored
fix: update on scroll restoration (#409)
1 parent c141b32 commit 48f2a61

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Sticky.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ class Sticky extends Component {
304304
) {
305305
this.props.onStateChange({ status: this.state.status });
306306
}
307+
308+
// check if we are up-to-date, is triggered in case of scroll restoration
309+
if (this.props.top !== prevState.top) {
310+
this.updateInitialDimension();
311+
this.update();
312+
}
313+
307314
const arePropsChanged = !shallowEqual(this.props, prevProps);
308315
if (arePropsChanged) {
309316
// if the props for enabling are toggled, then trigger the update or reset depending on the current props

0 commit comments

Comments
 (0)