@remix-run/router 1.5.0-pre.0 → 1.5.0-pre.2
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/CHANGELOG.md +12 -0
- package/dist/router.cjs.js +8 -2
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +2 -2
- package/dist/router.js +8 -3
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +8 -2
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/router.ts +14 -2
package/package.json
CHANGED
package/router.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "./history";
|
|
10
10
|
import type {
|
|
11
11
|
DataResult,
|
|
12
|
+
DeferredData,
|
|
12
13
|
AgnosticDataRouteMatch,
|
|
13
14
|
AgnosticDataRouteObject,
|
|
14
15
|
DeferredResult,
|
|
@@ -33,7 +34,6 @@ import type {
|
|
|
33
34
|
MutationFormMethod,
|
|
34
35
|
} from "./utils";
|
|
35
36
|
import {
|
|
36
|
-
DeferredData,
|
|
37
37
|
ErrorResponse,
|
|
38
38
|
ResultType,
|
|
39
39
|
convertRoutesToDataRoutes,
|
|
@@ -3486,7 +3486,7 @@ async function callLoaderOrAction(
|
|
|
3486
3486
|
return { type: resultType, error: result };
|
|
3487
3487
|
}
|
|
3488
3488
|
|
|
3489
|
-
if (result
|
|
3489
|
+
if (isDeferredData(result)) {
|
|
3490
3490
|
return {
|
|
3491
3491
|
type: ResultType.deferred,
|
|
3492
3492
|
deferredData: result,
|
|
@@ -3856,6 +3856,18 @@ function isRedirectResult(result?: DataResult): result is RedirectResult {
|
|
|
3856
3856
|
return (result && result.type) === ResultType.redirect;
|
|
3857
3857
|
}
|
|
3858
3858
|
|
|
3859
|
+
export function isDeferredData(value: any): value is DeferredData {
|
|
3860
|
+
let deferred: DeferredData = value;
|
|
3861
|
+
return (
|
|
3862
|
+
deferred &&
|
|
3863
|
+
typeof deferred === "object" &&
|
|
3864
|
+
typeof deferred.data === "object" &&
|
|
3865
|
+
typeof deferred.subscribe === "function" &&
|
|
3866
|
+
typeof deferred.cancel === "function" &&
|
|
3867
|
+
typeof deferred.resolveData === "function"
|
|
3868
|
+
);
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3859
3871
|
function isResponse(value: any): value is Response {
|
|
3860
3872
|
return (
|
|
3861
3873
|
value != null &&
|