File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
packages/playground/website/src/lib/state/url Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -60,11 +60,11 @@ export function parseRouteParam(route: string | null): RouteState {
6060
6161/**
6262 * Build a route parameter string from a RouteState object.
63- * Returns undefined if the sidebar is closed (default state) .
63+ * Returns 'closed' if the sidebar is closed.
6464 */
65- export function buildRouteParam ( state : RouteState ) : string | undefined {
65+ export function buildRouteParam ( state : RouteState ) : string {
6666 if ( ! state . sidebarOpen ) {
67- return undefined ;
67+ return 'closed' ;
6868 }
6969
7070 if ( state . section === 'sidebar' ) {
@@ -89,13 +89,7 @@ export function buildRouteParam(state: RouteState): string | undefined {
8989export function updateRouteInUrl ( state : RouteState ) : void {
9090 const url = new URL ( window . location . href ) ;
9191 const routeValue = buildRouteParam ( state ) ;
92-
93- if ( routeValue === undefined ) {
94- url . searchParams . delete ( 'route' ) ;
95- } else {
96- url . searchParams . set ( 'route' , routeValue ) ;
97- }
98-
92+ url . searchParams . set ( 'route' , routeValue ) ;
9993 window . history . replaceState ( { } , '' , url . href ) ;
10094}
10195
You can’t perform that action at this time.
0 commit comments