Skip to content

Update Router.route type def#32

Open
trusktr wants to merge 1 commit into
thepassle:masterfrom
trusktr:patch-1
Open

Update Router.route type def#32
trusktr wants to merge 1 commit into
thepassle:masterfrom
trusktr:patch-1

Conversation

@trusktr
Copy link
Copy Markdown

@trusktr trusktr commented Aug 21, 2025

A Router's .route property is initially undefined, and not available until after the first microtask after instantiation.

const router = new Router()

console.log(router.route) // undefined

queueMicrotask(() => {
  console.log(router.route) // Route
})

.route is set upon first navigate() call, here:

this.route = route;

First navigate() happens here:

queueMicrotask(() => {
this.navigate(new URL(window.location.href), { replace: true });
});

A Router's `.route` property is initially undefined, and not available until after the first microtask after instantiation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant