Commit f254b1b 1 parent 0fc4b1c commit f254b1b Copy full SHA for f254b1b
File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -155,8 +155,21 @@ export class Router {
155
155
}
156
156
157
157
protected handleBackForwardVisit ( page : Page ) : void {
158
- window . history . state . version = page . version
159
- this . setPage ( window . history . state , { preserveScroll : true , preserveState : true } ) . then ( ( ) => {
158
+ let currentState
159
+
160
+ /* This ensures we give precedence to a fresh state.
161
+ 'page' here holds the props from the latest backend request.
162
+ This prevents user A logging out and user B seeing sensitive data
163
+ from user A by going back in the history (shared computer)
164
+ */
165
+ if ( page ) {
166
+ currentState = page
167
+ } else {
168
+ window . history . state . version = page . version
169
+ currentState = window . history . state
170
+ }
171
+
172
+ this . setPage ( currentState , { preserveScroll : true , preserveState : true } ) . then ( ( ) => {
160
173
this . restoreScrollPositions ( )
161
174
fireNavigateEvent ( page )
162
175
} )
You can’t perform that action at this time.
0 commit comments