reactjrx 1.135.6 → 1.138.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.
@@ -1,6 +1,25 @@
1
1
  import { Signal, VirtualSignal } from '../Signal';
2
+ export type EqualityFn<T> = (a: T, b: T) => boolean;
3
+ /**
4
+ * Subscribe to a signal's current value, with optional projection and equality.
5
+ *
6
+ * - On every render the returned value is `selector(signal.value)` (or
7
+ * `signal.value` when no selector is provided), recomputed only when the
8
+ * signal value, the selector identity, or the signal itself has changed.
9
+ * - The component re-renders whenever the signal emits a value that the
10
+ * `equalityFn` considers different from the previous one.
11
+ * - The hook caches its last result. When the new selector output is
12
+ * considered equal to the previous one (per `equalityFn`), the previous
13
+ * reference is returned, so downstream `useEffect`/`useMemo` dependencies
14
+ * stay stable.
15
+ *
16
+ * @param signal The signal (or `VirtualSignal` resolved through context) to read.
17
+ * @param selector Optional projection of the signal value.
18
+ * @param equalityFn Optional equality function. Defaults to `Object.is`.
19
+ * Pass `isShallowEqual` (or any custom comparator) to opt into reference
20
+ * stability for derived objects.
21
+ */
2
22
  export declare function useSignalValue<T>(signal: VirtualSignal<T>): T;
3
- export declare function useSignalValue<T, SelectValue>(signal: VirtualSignal<T>, selector: (value: T) => SelectValue): SelectValue;
23
+ export declare function useSignalValue<T, SelectValue>(signal: VirtualSignal<T>, selector: (value: T) => SelectValue, equalityFn?: EqualityFn<SelectValue>): SelectValue;
4
24
  export declare function useSignalValue<T>(signal: Signal<T>): T;
5
- export declare function useSignalValue<T, SelectValue>(signal: Signal<T>, selector: (value: T) => SelectValue): SelectValue;
6
- export declare function useSignalValue<T, SelectValue>(signal: Signal<T>, selector: (value: T) => SelectValue): SelectValue | undefined;
25
+ export declare function useSignalValue<T, SelectValue>(signal: Signal<T>, selector: (value: T) => SelectValue, equalityFn?: EqualityFn<SelectValue>): SelectValue;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjrx",
3
3
  "private": false,
4
- "version": "1.135.6",
4
+ "version": "1.138.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -39,7 +39,7 @@
39
39
  "rxjs": "*"
40
40
  },
41
41
  "devDependencies": {
42
- "@biomejs/biome": "2.3.11",
42
+ "@biomejs/biome": "2.4.13",
43
43
  "@tanstack/react-query-persist-client": "^5.96.2",
44
44
  "@testing-library/jest-dom": "^6.2.0",
45
45
  "@testing-library/react": "^16.1.0",