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

Code before:
    request,
    match,
    lazyRoutePropertiesToSkip,
  );

  return {
    ...match,
    _lazyPromises,
    shouldLoad,
    unstable_shouldRevalidateArgs,
    unstable_shouldCallHandler(defaultShouldRevalidate) {
      isUsingNewApi = true;
      if (!unstable_shouldRevalidateArgs) {
        return shouldLoad;
      }

      if (typeof defaultShouldRevalidate === "boolean") {
        return shouldRevalidateLoader(match, {
          ...unstable_shouldRevalidateArgs,
          defaultShouldRevalidate,
        });
      }
      return shouldRevalidateLoader(match, unstable_shouldRevalidateArgs);
    },
    resolve(handlerOverride) {
      let { lazy, loader, action, middleware } = match.route;

      let callHandler =
        isUsingNewApi ||
        shouldLoad ||
        (handlerOverride &&
          !isMutationMethod(request.method) &&
          (lazy || loader));

      // If this match was marked `shouldLoad` due to a middleware and it
      // doesn't have a `loader` or `action` to run and no `lazy` to add one, then we can
      // just return undefined from the "loader" here
      let isMiddlewareOnlyRoute =
        middleware && middleware.length > 0 && !loader && !action && !lazy;

      if (callHandler && !isMiddlewareOnlyRoute) {
        return callLoaderOrAction({
          request,
          match,
          lazyHandlerPromise: _lazyPromises?.handler,
          lazyRoutePromise: _lazyPromises?.route,
          handlerOverride,
          scopedContext,
        });
      }
      return Promise.resolve({ type: ResultType.data, result: undefined });

Review comment (suggestion):
```suggestion
      let { lazy, loader, middleware } = match.route;
```

Code after:
    request,
    match,
    lazyRoutePropertiesToSkip,
  );

  return {
    ...match,
    _lazyPromises,
    shouldLoad,
    unstable_shouldRevalidateArgs,
    unstable_shouldCallHandler(defaultShouldRevalidate) {
      isUsingNewApi = true;
      if (!unstable_shouldRevalidateArgs) {
        return shouldLoad;
      }

      if (typeof defaultShouldRevalidate === "boolean") {
        return shouldRevalidateLoader(match, {
          ...unstable_shouldRevalidateArgs,
          defaultShouldRevalidate,
        });
      }
      return shouldRevalidateLoader(match, unstable_shouldRevalidateArgs);
    },
    resolve(handlerOverride) {
      let { lazy, loader, middleware } = match.route;

      let callHandler =
        isUsingNewApi ||
        shouldLoad ||
        (handlerOverride &&
          !isMutationMethod(request.method) &&
          (lazy || loader));

      // For GET requests, if this match was marked `shouldLoad` due to a
      // middleware and it doesn't have a `loader` to run and no `lazy` to add
      // one, then we can just return undefined from the "loader" here
      let isMiddlewareOnlyRoute =
        middleware && middleware.length > 0 && !loader && !lazy;

      if (
        callHandler &&
        (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)
      ) {
        return callLoaderOrAction({
          request,
          match,
          lazyHandlerPromise: _lazyPromises?.handler,
          lazyRoutePromise: _lazyPromises?.route,
          handlerOverride,
          scopedContext,