You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/get-scope.ts
+19-1Lines changed: 19 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,31 @@ function getServerScope(values?: Values) {
16
16
* This temporary solution on hacks allows us to solve the pain of library users when working with Next.js, as well as gather much more information to develop a better API.
17
17
*/
18
18
const_currentScope: Scope=fork();
19
+
letprevValues: Values;
19
20
/**
20
21
* @private
21
22
*
22
23
* exported for tests only
23
24
*/
24
25
exportfunctiongetClientScope(values?: Values){
25
-
if(!values)return_currentScope;
26
+
if(
27
+
!values||
28
+
/**
29
+
* This is a hack to handle edge cases with shallow navigation
30
+
*
31
+
* In this case Next.js will basically re-use old pageProps,
32
+
* but we already have latest state in the client scope
33
+
*
34
+
* So this update is just skipped
35
+
*/
36
+
values===prevValues
37
+
)
38
+
return_currentScope;
39
+
40
+
/**
41
+
* Saving previous values to handle edge cases with shallow navigation
0 commit comments