You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading from tanstack router 1.131.x to > 1.132.x we've encountered a Cannot be parsed as a URL against "null" error when bundled for production and deployed to our deployment target as thrown by a parseLocation method when attempting to construct a URL object
In our context we are using Tanstack Router in SPA mode and deploying to Veeva CRM (think of this as a CMS). Veeva serves the SPA using file: protocol and we've narrowed down that when this is performed window.origin returns the string literal "null"
as of >1.132.0 the following code exists in router.ts in router-core
this.origin = this.options.origin
if (!this.origin) {
if (!this.isServer) {
this.origin = window.origin
} else {
// fallback for the server, can be overridden by calling router.update({origin}) on the server
this.origin = 'http://localhost'
}
}
in our context this.options.origin is undefined, and this.isServer is false so this.origin = window.origin is invoked and as mentioned window.origin is "null" later when parseLocation is called the error is thrown when code like `new URL("/", this.origin) is invoked by tanstack router
I think we can reasonably workaround this by setting the origin when invoking createRouter for example
Activity
fix: fallback if origin is 'null'