Skip to content

router: Expose current page as URL param

Eric Gardner requested to merge url-pagination-1 into main
  • Adds a new "page" prop to the route definition for Results; this is handled as a number even though URL params are really strings, so type-casting via Number() is necessary for correct behavior.
  • Adds a route guard to ensure that any value supplied for this URL param is a valid number by checking isNan( Number( param ) ). If the initial param value is not a number, the route is modified to use "1" as the page value (all other params are left alone).
  • Modifies the ResultsView component to receive "page" as a prop from the router. Any existing logic that mutated the value of the currentPage ref has been updated to call router.push() instead.

Bug: T336317

Edited by Eric Gardner

Merge request reports