@colisweb/rescript-toolkit 5.35.7 → 5.36.0
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/package.json +1 -1
- package/src/request/Request.res +9 -4
package/package.json
CHANGED
package/src/request/Request.res
CHANGED
|
@@ -322,6 +322,11 @@ let mutateWithParams = (
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
module FetchAndRender = {
|
|
325
|
+
type childrenParams<'argument, 'data> = {
|
|
326
|
+
data: 'data,
|
|
327
|
+
reload: unit => Promise.t<result<bool, Js.Promise.error>>,
|
|
328
|
+
isLoading: bool,
|
|
329
|
+
}
|
|
325
330
|
@react.component
|
|
326
331
|
let make = (
|
|
327
332
|
type argument response err,
|
|
@@ -332,11 +337,11 @@ module FetchAndRender = {
|
|
|
332
337
|
),
|
|
333
338
|
~argument,
|
|
334
339
|
~options=?,
|
|
335
|
-
~children,
|
|
340
|
+
~children: childrenParams<argument, response> => React.element,
|
|
336
341
|
) => {
|
|
337
|
-
let (data,
|
|
342
|
+
let (data, isLoading, reload) = useFetcher(~options?, config, Some(argument))
|
|
338
343
|
|
|
339
|
-
children(data)
|
|
344
|
+
children({data, reload, isLoading})
|
|
340
345
|
}
|
|
341
346
|
}
|
|
342
347
|
|
|
@@ -350,7 +355,7 @@ module FetchAndRenderWithSuspense = {
|
|
|
350
355
|
and type error = err
|
|
351
356
|
),
|
|
352
357
|
~argument,
|
|
353
|
-
~children,
|
|
358
|
+
~children: FetchAndRender.childrenParams<argument, response> => React.element,
|
|
354
359
|
~fallback=?,
|
|
355
360
|
~options=?,
|
|
356
361
|
~fallbackRender,
|