diff --git a/packages/react-router/src/route.ts b/packages/react-router/src/route.ts index 7797b496bc..79d0cf3d34 100644 --- a/packages/react-router/src/route.ts +++ b/packages/react-router/src/route.ts @@ -887,35 +887,35 @@ export class Route< private _to!: TrimPathRight public get to() { - invariant( + /* invariant( this._to, `trying to access property 'to' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`, - ) + )*/ return this._to } public get id() { - invariant( + /* invariant( this._id, `trying to access property 'id' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`, - ) + )*/ return this._id } public get path() { - invariant( + /* invariant( // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition this.isRoot || this._id || this._path, `trying to access property 'path' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`, - ) + )*/ return this._path } public get fullPath() { - invariant( + /* invariant( this._fullPath, `trying to access property 'fullPath' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`, - ) + )*/ return this._fullPath } diff --git a/packages/react-router/tests/route.test.tsx b/packages/react-router/tests/route.test.tsx index fd881e328f..a5a9a018b2 100644 --- a/packages/react-router/tests/route.test.tsx +++ b/packages/react-router/tests/route.test.tsx @@ -8,7 +8,6 @@ import { useNavigate, } from '../src' import React from 'react' -import exp from 'constants' describe('getRouteApi', () => { it('should have the useMatch hook', () => { @@ -60,6 +59,7 @@ describe('createRoute has the same hooks as getRouteApi', () => { ) }) +/* disabled until HMR bug is fixed describe('throws invariant exception when trying to access properties before `createRouter` completed', () => { function setup() { const rootRoute = createRootRoute() @@ -138,3 +138,4 @@ describe('throws invariant exception when trying to access properties before `cr expect(postsRoute.to).toBe('/posts') }) }) +*/