fix: une mutation ne rend ni n-atteint ce que la vue cache

`Set.prototype.add` rend THIS pour permettre le chainage - EXECUTE, pas deduit,
sur le `Set` nu et sur le vrai `DeepSignalSet`, qui rendent tous deux la
collection. Les trois mutations etaient transmises liees a la cible sur le motif
ecrit juste au-dessus : "elles prennent un objet et rendent void ou un booleen,
donc elles ne laissent rien fuir". Faux pour `add`, et `add` est le PREMIER
membre que l-exemple de documentation du SDK emploie. Toutes les entrees etaient
filtrees et la sortie rendait la collection entiere.

Les deux autres rendaient bien ce que le motif disait, et AGISSAIENT au-dela de
la vue : `delete` retirait un objet dont `has` refuse meme de confirmer
l-existence - les deux se contredisaient - et `clear` vidait la collection que
toutes les identites partagent.

Une seule regle : une mutation atteint la collection dessous, mais ne rend ni
n-atteint ce que la vue cache. `add` rend la VUE, `delete` n-agit que sur ce que
la vue montre, `clear` vide la vue. L-ecriture atteint toujours le document.

Le motif commun aux cinq fuites de cette famille est une JUSTIFICATION ECRITE
SUR UNE VALEUR DE RETOUR JAMAIS EXECUTEE. Chacune etait raisonnable, aucune
n-avait ete jouee.

Aussi : la forme ordonnee rend des index la ou un Set rend des objets
(`keys`/`entries`/`forEach`), et le faux partage reproduit desormais le
`isLoading` LIVRE - inverse de sa propre declaration. L-inversion est amont ;
un faux plus correct que la cible recree l-aveuglement que cette tache enleve.
This commit is contained in:
Sylvain Duchesne
2026-09-24 19:00:19 +02:00
parent 0e2b8ba394
commit c5de1cea35
6 changed files with 221 additions and 24 deletions
+11 -4
View File
@@ -23,7 +23,11 @@
* - `promise` resolves to that same collection, and is `undefined` when `conf` is;
* - `subscription` is the handle, carrying the items three ways of its own -
* `signalObject`, `readyPromise` and the raw arrays a change listener is handed;
* - `isLoading` is a boolean, the one member that carries nothing;
* - `isLoading` is a boolean, the one member that carries nothing - reproduced with the
* shipped EXPRESSION, `ormSubscription.isReady`, which is the INVERSE of what the
* declaration beside it describes ("`true` when no data is available yet"). The
* inversion is upstream's, and a fake that quietly corrected it would be measuring a
* hook nobody ships - which is the exact blindness this file exists to remove;
* - the two page commands exist only under a paginated config, as `WithMaybePagination`
* `Omit`s them otherwise and the shipped hook leaves them `undefined`.
*
@@ -60,8 +64,9 @@ export interface FakeShapeHook {
* A fake `useShape` over an in-memory row list.
*
* `loaded` (the default) answers as a hook whose payload has arrived. Turn it off for the
* state the declaration describes as "still loading": `data` and `promise` present but the
* data not there yet.
* state the declaration describes as "still loading": `promise` present but `data` not
* there yet. Note which way `isLoading` then reads - see the note above; it follows the
* shipped expression, not the shipped prose.
*/
export function makeUseShapeHook(
options: { loaded?: boolean; paginated?: boolean } = {},
@@ -104,7 +109,9 @@ export function makeUseShapeHook(
data: loaded ? collection : undefined,
promise: Promise.resolve(collection),
subscription,
isLoading: !loaded,
// Upstream, verbatim: `!ormSubscription ? false : ormSubscription.isReady`. There is
// a subscription here, so this is `isReady` - and `isReady` is `loaded`.
isLoading: loaded,
nextPage: paginated ? (): void => void pages.push("next") : undefined,
previousPage: paginated ? (): void => void pages.push("previous") : undefined,
};