flurryx 1.2.1 → 1.3.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/README.md +11 -13
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -571,15 +571,15 @@ For data indexed by ID (user profiles, invoices, config entries), use `KeyedReso
|
|
|
571
571
|
|
|
572
572
|
```typescript
|
|
573
573
|
interface KeyedResourceData<TKey extends string | number, TValue> {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
status: Partial<Record<TKey, ResourceStatus>>;
|
|
577
|
-
errors: Partial<Record<TKey, ResourceErrors>>;
|
|
574
|
+
[key: string]: ResourceState<TValue> | undefined;
|
|
575
|
+
[key: number]: ResourceState<TValue> | undefined;
|
|
578
576
|
}
|
|
579
577
|
```
|
|
580
578
|
|
|
581
579
|
Each resource key gets **independent** loading, status, and error tracking. The top-level `ResourceState.isLoading` reflects whether _any_ key is loading.
|
|
582
580
|
|
|
581
|
+
On first keyed fetch, `syncToKeyedStore(..., id)` now bootstraps keyed slot immediately on subscribe. That means `data?.[id]?.isLoading` becomes `true` before first response arrives, without manually seeding `createKeyedResourceData()`.
|
|
582
|
+
|
|
583
583
|
**Full example:**
|
|
584
584
|
|
|
585
585
|
```typescript
|
|
@@ -610,18 +610,18 @@ export class InvoiceFacade {
|
|
|
610
610
|
|
|
611
611
|
// Component
|
|
612
612
|
const data = this.facade.items().data; // KeyedResourceData
|
|
613
|
-
const invoice = data?.
|
|
614
|
-
const loading = data?.
|
|
615
|
-
const errors = data?.
|
|
613
|
+
const invoice = data?.["inv-123"]?.data; // Invoice | undefined
|
|
614
|
+
const loading = data?.["inv-123"]?.isLoading; // boolean | undefined
|
|
615
|
+
const errors = data?.["inv-123"]?.errors; // ResourceErrors | undefined
|
|
616
616
|
```
|
|
617
617
|
|
|
618
618
|
**Utilities:**
|
|
619
619
|
|
|
620
620
|
```typescript
|
|
621
621
|
import {
|
|
622
|
-
createKeyedResourceData, // factory — returns empty
|
|
622
|
+
createKeyedResourceData, // factory — returns empty keyed object {}
|
|
623
623
|
isKeyedResourceData, // type guard
|
|
624
|
-
isAnyKeyLoading, // (
|
|
624
|
+
isAnyKeyLoading, // (data: KeyedResourceData) => boolean
|
|
625
625
|
} from "flurryx";
|
|
626
626
|
```
|
|
627
627
|
|
|
@@ -979,10 +979,8 @@ export class SessionStore {
|
|
|
979
979
|
|
|
980
980
|
// After loading customers "c1" and "c2", the cache contains:
|
|
981
981
|
// {
|
|
982
|
-
//
|
|
983
|
-
//
|
|
984
|
-
// status: { c1: 'Success', c2: 'Success' },
|
|
985
|
-
// errors: {}
|
|
982
|
+
// c1: { data: Customer, isLoading: false, status: 'Success' },
|
|
983
|
+
// c2: { data: Customer, isLoading: false, status: 'Success' }
|
|
986
984
|
// }
|
|
987
985
|
}
|
|
988
986
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flurryx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Signal-first reactive state management for Angular",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
},
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flurryx/core": "1.
|
|
42
|
-
"@flurryx/store": "1.
|
|
43
|
-
"@flurryx/rx": "1.
|
|
41
|
+
"@flurryx/core": "1.2.0",
|
|
42
|
+
"@flurryx/store": "1.3.0",
|
|
43
|
+
"@flurryx/rx": "1.3.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@angular/core": ">=17.0.0",
|