File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ export class LocationState {
2222
2323 /**
2424 * Normalizes state data to ensure it conforms to the expected State interface.
25+ *
26+ * **NOTE**: In order to avoid serialization errors of the provided data, which might contain reactive Svelte
27+ * proxies, the returned data is a clean snapshot of the normalized data.
28+ *
2529 * @param state The state to normalize
2630 * @param defaultState Optional default state to use if normalization is needed
2731 * @returns Normalized state that conforms to the State interface
@@ -34,6 +38,6 @@ export class LocationState {
3438 logger . warn ( `Non-conformant state data detected. ${ action } ` ) ;
3539 }
3640
37- return validState ? state : ( defaultState ?? { path : undefined , hash : { } } ) ;
41+ return $state . snapshot ( validState ? state : ( defaultState ?? { path : undefined , hash : { } } ) ) ;
3842 }
3943}
You can’t perform that action at this time.
0 commit comments