@@ -33,7 +33,7 @@ class URLWithReactiveSearchParams extends URL {
33
33
* @override
34
34
*/
35
35
get search ( ) {
36
- this . searchParams . toString ( ) ;
36
+ this . #reactive_search_params . toString ( ) ;
37
37
this . #sync_params_with_url( 'search_params' ) ;
38
38
return super . search ;
39
39
}
@@ -50,7 +50,7 @@ class URLWithReactiveSearchParams extends URL {
50
50
* @override
51
51
*/
52
52
get href ( ) {
53
- this . searchParams . toString ( ) ;
53
+ this . #reactive_search_params . toString ( ) ;
54
54
this . #sync_params_with_url( 'search_params' ) ;
55
55
return super . href ;
56
56
}
@@ -67,15 +67,15 @@ class URLWithReactiveSearchParams extends URL {
67
67
* @param {"url" | "search_params" } changed_value
68
68
*/
69
69
#sync_params_with_url( changed_value ) {
70
- if ( super . searchParams . toString ( ) === this . searchParams . toString ( ) ) {
70
+ if ( super . searchParams . toString ( ) === this . #reactive_search_params . toString ( ) ) {
71
71
return ;
72
72
}
73
73
74
74
if ( changed_value == 'url' ) {
75
75
this . #update_search_params_from_url( ) ;
76
76
} else {
77
77
// updating url from params
78
- this . search = this . searchParams . toString ( ) ;
78
+ this . search = this . #reactive_search_params . toString ( ) ;
79
79
}
80
80
}
81
81
@@ -87,34 +87,34 @@ class URLWithReactiveSearchParams extends URL {
87
87
const keys_with_no_change = [ ] ;
88
88
89
89
// remove keys that don't exist anymore and notify others
90
- for ( const [ key , value ] of Array . from ( this . searchParams . entries ( ) ) ) {
90
+ for ( const [ key , value ] of Array . from ( this . #reactive_search_params . entries ( ) ) ) {
91
91
if ( ! super . searchParams . has ( key ) || value == super . searchParams . get ( key ) ) {
92
92
keys_with_no_change . push ( key ) ;
93
93
untrack ( ( ) => {
94
- this . searchParams . delete ( key ) ;
94
+ this . #reactive_search_params . delete ( key ) ;
95
95
} ) ;
96
96
continue ;
97
97
}
98
- this . searchParams . delete ( key ) ;
98
+ this . #reactive_search_params . delete ( key ) ;
99
99
}
100
100
101
101
// set or update keys based on the params
102
102
for ( const [ key , value ] of super . searchParams . entries ( ) ) {
103
103
if ( keys_with_no_change . includes ( key ) ) {
104
104
untrack ( ( ) => {
105
- this . searchParams . set ( key , value ) ;
105
+ this . #reactive_search_params . set ( key , value ) ;
106
106
} ) ;
107
107
continue ;
108
108
}
109
- this . searchParams . set ( key , value ) ;
109
+ this . #reactive_search_params . set ( key , value ) ;
110
110
}
111
111
}
112
112
113
113
/**
114
114
* @override
115
115
*/
116
116
toString ( ) {
117
- this . searchParams . toString ( ) ;
117
+ this . #reactive_search_params . toString ( ) ;
118
118
this . #sync_params_with_url( 'search_params' ) ;
119
119
return super . toString ( ) ;
120
120
}
0 commit comments