@@ -5,22 +5,33 @@ export const ReactiveURLSearchParams = make_reactive(URLSearchParams, {
55 read_properties : [ 'get' , 'has' , 'getAll' ] ,
66 interceptors : {
77 set : ( options , ...params ) => {
8- if ( typeof params [ 0 ] == 'string' && options . value . get ( params [ 0 ] ) === params [ 1 ] ) {
8+ const value = options . value . get ( /**@type {string } */ ( params [ 0 ] ) ) ;
9+ const value_has_changed = value !== /**@type {string } */ ( params [ 1 ] ) . toString ( ) ;
10+ if ( value && ! value_has_changed ) {
911 return false ;
1012 }
11- options . notify_read_properties ( [ 'get' , 'has' , 'getAll' ] , params [ 0 ] ) ;
13+
14+ if ( ! value ) {
15+ options . notify_read_properties ( [ 'has' ] , params [ 0 ] ) ;
16+ }
17+
18+ if ( value_has_changed ) {
19+ options . notify_read_properties ( [ 'get' ] , params [ 0 ] ) ;
20+ }
21+
22+ options . notify_read_properties ( [ 'getAll' ] , params [ 0 ] ) ;
1223 return true ;
1324 } ,
1425 append : ( options , ...params ) => {
1526 options . notify_read_properties ( [ 'getAll' ] , params [ 0 ] ) ;
1627
17- if ( typeof params [ 0 ] == 'string' && ! options . value . has ( params [ 0 ] ) ) {
28+ if ( ! options . value . has ( /** @type { string } */ ( params [ 0 ] ) ) ) {
1829 options . notify_read_properties ( [ 'get' , 'has' ] , params [ 0 ] ) ;
1930 }
2031 return true ;
2132 } ,
2233 delete : ( options , ...params ) => {
23- if ( typeof params [ 0 ] == 'string' && ! options . value . has ( params [ 0 ] ) ) {
34+ if ( ! options . value . has ( /** @type { string } */ ( params [ 0 ] ) ) ) {
2435 return false ;
2536 }
2637 options . notify_read_properties ( [ 'get' , 'has' , 'getAll' ] , params [ 0 ] ) ;
0 commit comments