@tanstack/react-router 0.0.1-beta.229 → 0.0.1-beta.230

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.229",
4
+ "version": "0.0.1-beta.230",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -42,7 +42,7 @@
42
42
  "@babel/runtime": "^7.16.7",
43
43
  "tiny-invariant": "^1.3.1",
44
44
  "tiny-warning": "^1.0.3",
45
- "@tanstack/history": "0.0.1-beta.229"
45
+ "@tanstack/history": "0.0.1-beta.230"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "rollup --config rollup.config.js"
package/src/router.ts CHANGED
@@ -282,7 +282,6 @@ export class Router<
282
282
  'stringifySearch' | 'parseSearch' | 'context'
283
283
  >,
284
284
  ) => {
285
- const previousOptions = this.options
286
285
  this.options = {
287
286
  ...this.options,
288
287
  ...newOptions,
@@ -1065,7 +1064,19 @@ export class Router<
1065
1064
  showPending: false,
1066
1065
  }
1067
1066
 
1068
- const pendingPromise = new Promise((r) => setTimeout(r, 1000))
1067
+ const pendingMs =
1068
+ route.options.pendingMs ?? this.options.defaultPendingMs
1069
+
1070
+ let pendingPromise: Promise<void> | undefined
1071
+
1072
+ if (
1073
+ !preload &&
1074
+ pendingMs &&
1075
+ (route.options.pendingComponent ??
1076
+ this.options.defaultPendingComponent)
1077
+ ) {
1078
+ pendingPromise = new Promise((r) => setTimeout(r, pendingMs))
1079
+ }
1069
1080
 
1070
1081
  if (match.isFetching) {
1071
1082
  loadPromise = getRouteMatch(this.state, match.id)?.loadPromise
@@ -1155,12 +1166,7 @@ export class Router<
1155
1166
  await new Promise<void>(async (resolve) => {
1156
1167
  // If the route has a pending component and a pendingMs option,
1157
1168
  // forcefully show the pending component
1158
- if (
1159
- !preload &&
1160
- (route.options.pendingComponent ??
1161
- this.options.defaultPendingComponent) &&
1162
- (route.options.pendingMs ?? this.options.defaultPendingMs)
1163
- ) {
1169
+ if (pendingPromise) {
1164
1170
  pendingPromise.then(() => {
1165
1171
  didShowPending = true
1166
1172
  matches[index] = match = {