@@ -64,6 +64,8 @@ export class State extends EventTarget {
6464 window . addEventListener ( "popstate" , ( ) => {
6565 this . #handlePopState( ) ;
6666 } ) ;
67+
68+ this . #updatePaginationUrl( ) ;
6769 }
6870
6971 getPageNo ( ) : number {
@@ -89,6 +91,7 @@ export class State extends EventTarget {
8991 updateFromResponse ( cause : StateChangeCause , count : number , filterLabels : ArrayLike < string > ) : void {
9092 this . #filter. setFilterLabels ( filterLabels ) ;
9193 this . #pagination. count = count ;
94+ this . #updatePaginationUrl( ) ;
9295 this . #selection. refresh ( ) ;
9396
9497 if ( cause === StateChangeCause . Change || cause === StateChangeCause . Pagination ) {
@@ -131,6 +134,30 @@ export class State extends EventTarget {
131134 window . history . pushState ( { } , document . title , url . toString ( ) ) ;
132135 }
133136
137+ #updatePaginationUrl( ) : void {
138+ if ( ! this . #baseUrl) {
139+ return ;
140+ }
141+
142+ const url = new URL ( this . #baseUrl) ;
143+
144+ const parameters : [ string , string ] [ ] = [ ] ;
145+ for ( const parameter of this . #sorting. getQueryParameters ( ) ) {
146+ parameters . push ( parameter ) ;
147+ }
148+
149+ for ( const parameter of this . #filter. getQueryParameters ( ) ) {
150+ parameters . push ( parameter ) ;
151+ }
152+
153+ if ( parameters . length > 0 ) {
154+ url . search += url . search !== "" ? "&" : "?" ;
155+ url . search += new URLSearchParams ( parameters ) . toString ( ) ;
156+ }
157+
158+ this . #pagination. url = url . toString ( ) ;
159+ }
160+
134161 #handlePopState( ) : void {
135162 let pageNo = 1 ;
136163
0 commit comments