@faasjs/react 8.0.0-beta.30 → 8.0.0-beta.32
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/dist/index.d.ts +5 -4
- package/dist/index.mjs +1 -25
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -228,7 +228,7 @@ type FaasDataInjection<Path extends FaasActionPaths> = {
|
|
|
228
228
|
* When the source hook is currently skipped, calling `reload` clears the skip
|
|
229
229
|
* flag before starting the next request.
|
|
230
230
|
*/
|
|
231
|
-
reload(params?: FaasParams<Path>, options?: {
|
|
231
|
+
reload(this: void, params?: FaasParams<Path>, options?: {
|
|
232
232
|
silent?: boolean;
|
|
233
233
|
}): Promise<FaasData<Path>>; /** Controlled or internal setter for the resolved data value. */
|
|
234
234
|
setData: React.Dispatch<React.SetStateAction<FaasData<Path>>>; /** Setter for the loading flag. */
|
|
@@ -1045,8 +1045,8 @@ declare function usePrevious<T = any>(value: T): T | undefined;
|
|
|
1045
1045
|
* Custom hook that returns a stateful value and a ref to that value.
|
|
1046
1046
|
*
|
|
1047
1047
|
* @template T - The type of the value.
|
|
1048
|
-
* @param {T} [initialValue] - Initial state value.
|
|
1049
|
-
* @returns {[T
|
|
1048
|
+
* @param {T} [initialValue] - Initial state value. Defaults to `undefined`.
|
|
1049
|
+
* @returns {[T, Dispatch<SetStateAction<T>>, RefObject<T>]} Tuple containing the current state, the state setter, and a ref that always points at the latest state.
|
|
1050
1050
|
*
|
|
1051
1051
|
* @example
|
|
1052
1052
|
* ```tsx
|
|
@@ -1065,6 +1065,7 @@ declare function usePrevious<T = any>(value: T): T | undefined;
|
|
|
1065
1065
|
* }
|
|
1066
1066
|
* ```
|
|
1067
1067
|
*/
|
|
1068
|
-
declare function useStateRef<T
|
|
1068
|
+
declare function useStateRef<T>(initialValue: T | (() => T)): [T, Dispatch<SetStateAction<T>>, RefObject<T>];
|
|
1069
|
+
declare function useStateRef<T = undefined>(): [T | undefined, Dispatch<SetStateAction<T | undefined>>, RefObject<T | undefined>];
|
|
1069
1070
|
//#endregion
|
|
1070
1071
|
export { type BaseUrl, ErrorBoundary, ErrorBoundaryProps, ErrorChildrenProps, FaasBrowserClient, type FaasBrowserClientAction, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, FaasDataWrapperRef, FaasReactClient, FaasReactClientInstance, FaasReactClientOptions, type MockHandler, OnError, OptionalWrapper, OptionalWrapperProps, type Options, Response, ResponseError, type ResponseErrorProps, type ResponseHeaders, type ResponseProps, StateSetters, StatesWithSetters, UseFaasOptions, UseFaasStreamOptions, UseFaasStreamResult, createSplittingContext, equal, faas, generateId, getClient, setMock, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, useFaasStream, usePrevious, useSplittingState, useStateRef, withFaasData };
|
package/dist/index.mjs
CHANGED
|
@@ -1387,32 +1387,8 @@ function usePrevious(value) {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
//#endregion
|
|
1389
1389
|
//#region src/useStateRef/index.ts
|
|
1390
|
-
/**
|
|
1391
|
-
* Custom hook that returns a stateful value and a ref to that value.
|
|
1392
|
-
*
|
|
1393
|
-
* @template T - The type of the value.
|
|
1394
|
-
* @param {T} [initialValue] - Initial state value. When omitted, state starts as `null`.
|
|
1395
|
-
* @returns {[T | null, Dispatch<SetStateAction<T | null>>, RefObject<T | null>]} Tuple containing the current state, the state setter, and a ref that always points at the latest state.
|
|
1396
|
-
*
|
|
1397
|
-
* @example
|
|
1398
|
-
* ```tsx
|
|
1399
|
-
* import { useStateRef } from '@faasjs/react'
|
|
1400
|
-
*
|
|
1401
|
-
* function MyComponent() {
|
|
1402
|
-
* const [value, setValue, ref] = useStateRef(0)
|
|
1403
|
-
*
|
|
1404
|
-
* return (
|
|
1405
|
-
* <div>
|
|
1406
|
-
* <p>Value: {value}</p>
|
|
1407
|
-
* <button onClick={() => setValue(value + 1)}>Increment</button>
|
|
1408
|
-
* <button onClick={() => console.log(ref.current)}>Submit</button>
|
|
1409
|
-
* </div>
|
|
1410
|
-
* )
|
|
1411
|
-
* }
|
|
1412
|
-
* ```
|
|
1413
|
-
*/
|
|
1414
1390
|
function useStateRef(initialValue) {
|
|
1415
|
-
const [state, setState] = useState(initialValue
|
|
1391
|
+
const [state, setState] = useState(initialValue);
|
|
1416
1392
|
const ref = useRef(state);
|
|
1417
1393
|
useEffect(() => {
|
|
1418
1394
|
ref.current = state;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/react",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.32",
|
|
4
4
|
"homepage": "https://faasjs.com/doc/react/",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/faasjs/faasjs/issues"
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@faasjs/types": ">=8.0.0-beta.
|
|
29
|
+
"@faasjs/types": ">=8.0.0-beta.32",
|
|
30
30
|
"@types/react": "^19.0.0",
|
|
31
31
|
"react": "^19.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@faasjs/types": ">=8.0.0-beta.
|
|
34
|
+
"@faasjs/types": ">=8.0.0-beta.32"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=26.0.0",
|