@remix-run/router 0.0.0-experimental-0f2dd78c → 0.0.0-experimental-42adf24c

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v0.0.0-experimental-0f2dd78c
2
+ * @remix-run/router v0.0.0-experimental-42adf24c
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1975,7 +1975,7 @@ function createRouter(init) {
1975
1975
  shortCircuited,
1976
1976
  loaderData,
1977
1977
  errors
1978
- } = await handleLoaders(request, location, matches, loadingNavigation, opts && opts.submission, opts && opts.replace, pendingActionData, pendingError);
1978
+ } = await handleLoaders(request, location, matches, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, pendingActionData, pendingError);
1979
1979
 
1980
1980
  if (shortCircuited) {
1981
1981
  return;
@@ -2088,7 +2088,7 @@ function createRouter(init) {
2088
2088
  // errors, etc.
2089
2089
 
2090
2090
 
2091
- async function handleLoaders(request, location, matches, overrideNavigation, submission, replace, pendingActionData, pendingError) {
2091
+ async function handleLoaders(request, location, matches, overrideNavigation, submission, fetcherSubmission, replace, pendingActionData, pendingError) {
2092
2092
  // Figure out the right navigation we want to use for data loading
2093
2093
  let loadingNavigation = overrideNavigation;
2094
2094
 
@@ -2107,7 +2107,7 @@ function createRouter(init) {
2107
2107
  // we have it on the loading navigation so use that if available
2108
2108
 
2109
2109
 
2110
- let activeSubmission = submission ? submission : loadingNavigation.formMethod && loadingNavigation.formAction && loadingNavigation.formData && loadingNavigation.formEncType ? {
2110
+ let activeSubmission = submission || fetcherSubmission ? submission || fetcherSubmission : loadingNavigation.formMethod && loadingNavigation.formAction && loadingNavigation.formData && loadingNavigation.formEncType ? {
2111
2111
  formMethod: loadingNavigation.formMethod,
2112
2112
  formAction: loadingNavigation.formAction,
2113
2113
  formData: loadingNavigation.formData,
@@ -2321,7 +2321,7 @@ function createRouter(init) {
2321
2321
  fetchers: new Map(state.fetchers)
2322
2322
  });
2323
2323
  return startRedirectNavigation(state, actionResult, {
2324
- submission
2324
+ fetcherSubmission: submission
2325
2325
  });
2326
2326
  } // Process any non-redirect errors thrown
2327
2327
 
@@ -2541,6 +2541,7 @@ function createRouter(init) {
2541
2541
 
2542
2542
  let {
2543
2543
  submission,
2544
+ fetcherSubmission,
2544
2545
  replace
2545
2546
  } = _temp === void 0 ? {} : _temp;
2546
2547
 
@@ -2581,7 +2582,7 @@ function createRouter(init) {
2581
2582
  formData
2582
2583
  } = state.navigation;
2583
2584
 
2584
- if (!submission && formMethod && formAction && formData && formEncType) {
2585
+ if (!submission && !fetcherSubmission && formMethod && formAction && formData && formEncType) {
2585
2586
  submission = {
2586
2587
  formMethod,
2587
2588
  formAction,
@@ -2593,9 +2594,11 @@ function createRouter(init) {
2593
2594
  // redirected location
2594
2595
 
2595
2596
 
2596
- if (redirectPreserveMethodStatusCodes.has(redirect.status) && submission && isMutationMethod(submission.formMethod)) {
2597
+ let activeSubmission = submission || fetcherSubmission;
2598
+
2599
+ if (redirectPreserveMethodStatusCodes.has(redirect.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) {
2597
2600
  await startNavigation(redirectHistoryAction, redirectLocation, {
2598
- submission: _extends({}, submission, {
2601
+ submission: _extends({}, activeSubmission, {
2599
2602
  formAction: redirect.location
2600
2603
  }),
2601
2604
  // Preserve this flag across redirects
@@ -2608,11 +2611,14 @@ function createRouter(init) {
2608
2611
  overrideNavigation: {
2609
2612
  state: "loading",
2610
2613
  location: redirectLocation,
2614
+ // Only include navigational submissions on the navigation
2611
2615
  formMethod: submission ? submission.formMethod : undefined,
2612
2616
  formAction: submission ? submission.formAction : undefined,
2613
2617
  formEncType: submission ? submission.formEncType : undefined,
2614
2618
  formData: submission ? submission.formData : undefined
2615
2619
  },
2620
+ // Send fetcher submissions through for shouldRevalidate
2621
+ fetcherSubmission,
2616
2622
  // Preserve this flag across redirects
2617
2623
  preventScrollReset: pendingPreventScrollReset
2618
2624
  });