@colisweb/rescript-toolkit 5.33.0 → 5.33.1
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 +4 -4
package/package.json
CHANGED
package/src/request/Request.res
CHANGED
|
@@ -233,8 +233,8 @@ let useManualRequest = (
|
|
|
233
233
|
|
|
234
234
|
let useDebouncedManuelRequest = (
|
|
235
235
|
type argument response err,
|
|
236
|
-
~onSuccess: option<response => unit>=?,
|
|
237
|
-
~onError: option<error<err
|
|
236
|
+
~onSuccess: option<(response, 'value) => unit>=?,
|
|
237
|
+
~onError: option<(error<err>, 'value) => unit>=?,
|
|
238
238
|
~debounceDelay: int=300,
|
|
239
239
|
config: module(Config with
|
|
240
240
|
type argument = argument
|
|
@@ -253,11 +253,11 @@ let useDebouncedManuelRequest = (
|
|
|
253
253
|
fetchAPI(config, argument(newValue))
|
|
254
254
|
->Promise.tapOk(res => {
|
|
255
255
|
setValue(_ => newValue)
|
|
256
|
-
onSuccess->Option.forEach(fn => fn(res))
|
|
256
|
+
onSuccess->Option.forEach(fn => fn(res, newValue))
|
|
257
257
|
})
|
|
258
258
|
->Promise.tapError(e => {
|
|
259
259
|
setValue(_ => initialValue)
|
|
260
|
-
onError->Option.forEach(fn => fn(e))
|
|
260
|
+
onError->Option.forEach(fn => fn(e, newValue))
|
|
261
261
|
})
|
|
262
262
|
->ignore
|
|
263
263
|
}
|