Repository: remix-run/react-router
File: packages/react-router/lib/router/router.ts (TypeScript)

Code before:
      }
    } else if (initialMatches.some((m) => m.route.lazy)) {
      // All initialMatches need to be loaded before we're ready.  If we have lazy
      // functions around still then we'll need to run them in initialize()
      initialized = false;
      renderFallback = !initialized;
    } else if (
      !initialMatches.some((m) => routeHasLoaderOrMiddleware(m.route))
    ) {
      // If we've got no loaders or middleware to run, then we're good to go
      initialized = true;
      renderFallback = !initialized;
    } else {
      // With "partial hydration", we're initialized so long as we were
      // provided with hydrationData for every route with a loader, and no loaders
      // were marked for explicit hydration
      let loaderData = init.hydrationData
        ? init.hydrationData.loaderData
        : null;
      let errors = init.hydrationData ? init.hydrationData.errors : null;

      renderFallback = false;

      const shouldLoadRoute = (m: AgnosticDataRouteMatch) => {
        let status = getRouteHydrationStatus(m.route, loaderData, errors);
        renderFallback = renderFallback || status.renderFallback;
        return status.shouldLoad;
      };

      // If errors exist, don't consider routes below the boundary
      if (errors) {
        let idx = initialMatches.findIndex(
          (m) => errors![m.route.id] !== undefined,
        );
        initialized = initialMatches
          .slice(0, idx + 1)
          .every((m) => !shouldLoadRoute(m));
      } else {
        initialized = initialMatches.every((m) => !shouldLoadRoute(m));
      }
    }
  }

  let router: Router;
  let state: RouterState = {
    historyAction: init.history.action,
    location: init.history.location,
    matches: initialMatches,
    initialized,
    renderFallback,
    navigation: IDLE_NAVIGATION,

Review comment (suggestion):
Only when we have a `loader.hydrate` scenario will have `initialized == false && renderFallback == false`

Code after:
      }
    } else if (initialMatches.some((m) => m.route.lazy)) {
      // All initialMatches need to be loaded before we're ready.  If we have lazy
      // functions around still then we'll need to run them in initialize()
      initialized = false;
      renderFallback = !initialized;
    } else if (
      !initialMatches.some((m) => routeHasLoaderOrMiddleware(m.route))
    ) {
      // If we've got no loaders or middleware to run, then we're good to go
      initialized = true;
      renderFallback = !initialized;
    } else {
      // With "partial hydration", we're initialized so long as we were
      // provided with hydrationData for every route with a loader, and no loaders
      // were marked for explicit hydration
      let loaderData = init.hydrationData
        ? init.hydrationData.loaderData
        : null;
      let errors = init.hydrationData ? init.hydrationData.errors : null;
      let relevantMatches = initialMatches;

      // If errors exist, don't consider routes below the boundary
      if (errors) {
        let idx = initialMatches.findIndex(
          (m) => errors![m.route.id] !== undefined,
        );
        relevantMatches = relevantMatches.slice(0, idx + 1);
      }

      // Toggle renderFallback based on per-route values
      renderFallback = false;
      initialized = relevantMatches.every((m) => {
        let status = getRouteHydrationStatus(m.route, loaderData, errors);
        renderFallback = renderFallback || status.renderFallback;
        return !status.shouldLoad;
      });
    }
  }

  let router: Router;
  let state: RouterState = {
    historyAction: init.history.action,
    location: init.history.location,
    matches: initialMatches,
    initialized,
    renderFallback,
    navigation: IDLE_NAVIGATION,
    // Don't restore on initial updateState() if we were SSR'd
    restoreScrollPosition: init.hydrationData != null ? false : null,
    preventScrollReset: false,