@remix-run/router 0.0.0-experimental-00c655af → 0.0.0-experimental-b162e81d
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/dist/router.cjs.js +38 -17
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +3 -0
- package/dist/router.js +38 -17
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +38 -17
- 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 +32 -5
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v0.0.0-experimental-
|
|
2
|
+
* @remix-run/router v0.0.0-experimental-b162e81d
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2147,7 +2147,8 @@ function createRouter(init) {
|
|
|
2147
2147
|
formMethod: undefined,
|
|
2148
2148
|
formAction: undefined,
|
|
2149
2149
|
formEncType: undefined,
|
|
2150
|
-
formData: undefined
|
|
2150
|
+
formData: undefined,
|
|
2151
|
+
" _hasFetcherDoneAnything ": true
|
|
2151
2152
|
};
|
|
2152
2153
|
state.fetchers.set(rf.key, revalidatingFetcher);
|
|
2153
2154
|
});
|
|
@@ -2283,7 +2284,8 @@ function createRouter(init) {
|
|
|
2283
2284
|
let fetcher = _extends({
|
|
2284
2285
|
state: "submitting"
|
|
2285
2286
|
}, submission, {
|
|
2286
|
-
data: existingFetcher && existingFetcher.data
|
|
2287
|
+
data: existingFetcher && existingFetcher.data,
|
|
2288
|
+
" _hasFetcherDoneAnything ": true
|
|
2287
2289
|
});
|
|
2288
2290
|
|
|
2289
2291
|
state.fetchers.set(key, fetcher);
|
|
@@ -2313,14 +2315,18 @@ function createRouter(init) {
|
|
|
2313
2315
|
let loadingFetcher = _extends({
|
|
2314
2316
|
state: "loading"
|
|
2315
2317
|
}, submission, {
|
|
2316
|
-
data: undefined
|
|
2318
|
+
data: undefined,
|
|
2319
|
+
" _hasFetcherDoneAnything ": true
|
|
2317
2320
|
});
|
|
2318
2321
|
|
|
2319
2322
|
state.fetchers.set(key, loadingFetcher);
|
|
2320
2323
|
updateState({
|
|
2321
2324
|
fetchers: new Map(state.fetchers)
|
|
2322
2325
|
});
|
|
2323
|
-
return startRedirectNavigation(state, actionResult
|
|
2326
|
+
return startRedirectNavigation(state, actionResult, {
|
|
2327
|
+
submission,
|
|
2328
|
+
isFetchActionRedirect: true
|
|
2329
|
+
});
|
|
2324
2330
|
} // Process any non-redirect errors thrown
|
|
2325
2331
|
|
|
2326
2332
|
|
|
@@ -2348,7 +2354,9 @@ function createRouter(init) {
|
|
|
2348
2354
|
let loadFetcher = _extends({
|
|
2349
2355
|
state: "loading",
|
|
2350
2356
|
data: actionResult.data
|
|
2351
|
-
}, submission
|
|
2357
|
+
}, submission, {
|
|
2358
|
+
" _hasFetcherDoneAnything ": true
|
|
2359
|
+
});
|
|
2352
2360
|
|
|
2353
2361
|
state.fetchers.set(key, loadFetcher);
|
|
2354
2362
|
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, routesToUse, init.basename, {
|
|
@@ -2367,7 +2375,8 @@ function createRouter(init) {
|
|
|
2367
2375
|
formMethod: undefined,
|
|
2368
2376
|
formAction: undefined,
|
|
2369
2377
|
formEncType: undefined,
|
|
2370
|
-
formData: undefined
|
|
2378
|
+
formData: undefined,
|
|
2379
|
+
" _hasFetcherDoneAnything ": true
|
|
2371
2380
|
};
|
|
2372
2381
|
state.fetchers.set(staleKey, revalidatingFetcher);
|
|
2373
2382
|
fetchControllers.set(staleKey, abortController);
|
|
@@ -2405,7 +2414,8 @@ function createRouter(init) {
|
|
|
2405
2414
|
formMethod: undefined,
|
|
2406
2415
|
formAction: undefined,
|
|
2407
2416
|
formEncType: undefined,
|
|
2408
|
-
formData: undefined
|
|
2417
|
+
formData: undefined,
|
|
2418
|
+
" _hasFetcherDoneAnything ": true
|
|
2409
2419
|
};
|
|
2410
2420
|
state.fetchers.set(key, doneFetcher);
|
|
2411
2421
|
let didAbortFetchLoads = abortStaleFetchLoads(loadId); // If we are currently in a navigation loading state and this fetcher is
|
|
@@ -2446,7 +2456,8 @@ function createRouter(init) {
|
|
|
2446
2456
|
formEncType: undefined,
|
|
2447
2457
|
formData: undefined
|
|
2448
2458
|
}, submission, {
|
|
2449
|
-
data: existingFetcher && existingFetcher.data
|
|
2459
|
+
data: existingFetcher && existingFetcher.data,
|
|
2460
|
+
" _hasFetcherDoneAnything ": true
|
|
2450
2461
|
});
|
|
2451
2462
|
|
|
2452
2463
|
state.fetchers.set(key, loadingFetcher);
|
|
@@ -2506,7 +2517,8 @@ function createRouter(init) {
|
|
|
2506
2517
|
formMethod: undefined,
|
|
2507
2518
|
formAction: undefined,
|
|
2508
2519
|
formEncType: undefined,
|
|
2509
|
-
formData: undefined
|
|
2520
|
+
formData: undefined,
|
|
2521
|
+
" _hasFetcherDoneAnything ": true
|
|
2510
2522
|
};
|
|
2511
2523
|
state.fetchers.set(key, doneFetcher);
|
|
2512
2524
|
updateState({
|
|
@@ -2539,16 +2551,20 @@ function createRouter(init) {
|
|
|
2539
2551
|
|
|
2540
2552
|
let {
|
|
2541
2553
|
submission,
|
|
2542
|
-
replace
|
|
2554
|
+
replace,
|
|
2555
|
+
isFetchActionRedirect
|
|
2543
2556
|
} = _temp === void 0 ? {} : _temp;
|
|
2544
2557
|
|
|
2545
2558
|
if (redirect.revalidate) {
|
|
2546
2559
|
isRevalidationRequired = true;
|
|
2547
2560
|
}
|
|
2548
2561
|
|
|
2549
|
-
let redirectLocation = createLocation(state.location, redirect.location,
|
|
2562
|
+
let redirectLocation = createLocation(state.location, redirect.location, // TODO: This can be removed once we get rid of useTransition in Remix v2
|
|
2563
|
+
_extends({
|
|
2550
2564
|
_isRedirect: true
|
|
2551
|
-
}
|
|
2565
|
+
}, isFetchActionRedirect ? {
|
|
2566
|
+
_isFetchActionRedirect: true
|
|
2567
|
+
} : {}));
|
|
2552
2568
|
invariant(redirectLocation, "Expected a location on the redirect navigation"); // Check if this an absolute external redirect that goes to a new origin
|
|
2553
2569
|
|
|
2554
2570
|
if (ABSOLUTE_URL_REGEX.test(redirect.location) && isBrowser && typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") {
|
|
@@ -2694,7 +2710,8 @@ function createRouter(init) {
|
|
|
2694
2710
|
formMethod: undefined,
|
|
2695
2711
|
formAction: undefined,
|
|
2696
2712
|
formEncType: undefined,
|
|
2697
|
-
formData: undefined
|
|
2713
|
+
formData: undefined,
|
|
2714
|
+
" _hasFetcherDoneAnything ": true
|
|
2698
2715
|
};
|
|
2699
2716
|
state.fetchers.set(key, doneFetcher);
|
|
2700
2717
|
}
|
|
@@ -3800,8 +3817,11 @@ function createClientSideRequest(history, location, signal, submission) {
|
|
|
3800
3817
|
formMethod,
|
|
3801
3818
|
formEncType,
|
|
3802
3819
|
formData
|
|
3803
|
-
} = submission;
|
|
3804
|
-
|
|
3820
|
+
} = submission; // Didn't think we needed this but it turns out unlike other methods, patch
|
|
3821
|
+
// won't be properly normalized to uppercase and results in a 405 error.
|
|
3822
|
+
// See: https://fetch.spec.whatwg.org/#concept-method
|
|
3823
|
+
|
|
3824
|
+
init.method = formMethod.toUpperCase();
|
|
3805
3825
|
init.body = formEncType === "application/x-www-form-urlencoded" ? convertFormDataToSearchParams(formData) : formData;
|
|
3806
3826
|
} // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)
|
|
3807
3827
|
|
|
@@ -3937,7 +3957,8 @@ function processLoaderData(state, matches, matchesToLoad, results, pendingError,
|
|
|
3937
3957
|
formMethod: undefined,
|
|
3938
3958
|
formAction: undefined,
|
|
3939
3959
|
formEncType: undefined,
|
|
3940
|
-
formData: undefined
|
|
3960
|
+
formData: undefined,
|
|
3961
|
+
" _hasFetcherDoneAnything ": true
|
|
3941
3962
|
};
|
|
3942
3963
|
state.fetchers.set(key, doneFetcher);
|
|
3943
3964
|
}
|