@tanstack/router-devtools 1.3.5 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
return _extends.apply(this, arguments);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
var isProduction
|
|
51
|
+
var isProduction = "development" === 'production';
|
|
52
52
|
var prefix = 'Invariant failed';
|
|
53
53
|
function invariant(condition, message) {
|
|
54
54
|
if (condition) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
if (isProduction
|
|
57
|
+
if (isProduction) {
|
|
58
58
|
throw new Error(prefix);
|
|
59
59
|
}
|
|
60
60
|
var provided = typeof message === 'function' ? message() : message;
|
|
@@ -62,9 +62,8 @@
|
|
|
62
62
|
throw new Error(value);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
var isProduction = "development" === 'production';
|
|
66
65
|
function warning(condition, message) {
|
|
67
|
-
|
|
66
|
+
{
|
|
68
67
|
if (condition) {
|
|
69
68
|
return;
|
|
70
69
|
}
|
|
@@ -319,13 +318,15 @@
|
|
|
319
318
|
}
|
|
320
319
|
}
|
|
321
320
|
function useRouterState(opts) {
|
|
322
|
-
const
|
|
323
|
-
|
|
321
|
+
const contextRouter = useRouter({
|
|
322
|
+
warn: opts?.router === undefined
|
|
323
|
+
});
|
|
324
|
+
return useStore((opts?.router || contextRouter).__store, opts?.select);
|
|
324
325
|
}
|
|
325
|
-
function useRouter() {
|
|
326
|
+
function useRouter(opts) {
|
|
326
327
|
const resolvedContext = typeof document !== 'undefined' ? window.__TSR_ROUTER_CONTEXT__ || routerContext : routerContext;
|
|
327
328
|
const value = React__namespace.useContext(resolvedContext);
|
|
328
|
-
warning(value, 'useRouter must be used inside a <RouterProvider> component!');
|
|
329
|
+
warning(opts?.warn && value, 'useRouter must be used inside a <RouterProvider> component!');
|
|
329
330
|
return value;
|
|
330
331
|
}
|
|
331
332
|
function trimPathLeft(path) {
|