@remix-run/router 1.19.1 → 1.19.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/utils.ts CHANGED
@@ -63,14 +63,6 @@ export type DataResult =
63
63
  | RedirectResult
64
64
  | ErrorResult;
65
65
 
66
- /**
67
- * Result from a loader or action called via dataStrategy
68
- */
69
- export interface HandlerResult {
70
- type: "data" | "error";
71
- result: unknown; // data, Error, Response, DeferredData, DataWithResponseInit
72
- }
73
-
74
66
  type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
75
67
  type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
76
68
 
@@ -241,17 +233,26 @@ export interface DataStrategyMatch
241
233
  resolve: (
242
234
  handlerOverride?: (
243
235
  handler: (ctx?: unknown) => DataFunctionReturnValue
244
- ) => Promise<HandlerResult>
245
- ) => Promise<HandlerResult>;
236
+ ) => DataFunctionReturnValue
237
+ ) => Promise<DataStrategyResult>;
246
238
  }
247
239
 
248
240
  export interface DataStrategyFunctionArgs<Context = any>
249
241
  extends DataFunctionArgs<Context> {
250
242
  matches: DataStrategyMatch[];
243
+ fetcherKey: string | null;
244
+ }
245
+
246
+ /**
247
+ * Result from a loader or action called via dataStrategy
248
+ */
249
+ export interface DataStrategyResult {
250
+ type: "data" | "error";
251
+ result: unknown; // data, Error, Response, DeferredData, DataWithResponseInit
251
252
  }
252
253
 
253
254
  export interface DataStrategyFunction {
254
- (args: DataStrategyFunctionArgs): Promise<HandlerResult[]>;
255
+ (args: DataStrategyFunctionArgs): Promise<Record<string, DataStrategyResult>>;
255
256
  }
256
257
 
257
258
  export interface AgnosticPatchRoutesOnNavigationFunction<