mirror of
https://github.com/chmouel/liseur-sync.git
synced 2026-08-28 00:41:42 +00:00
The web reader guarded the fraction it pushes with a typeof check, and typeof NaN is "number". JSON.stringify turns that NaN into null, and the op handler decoded progression into a plain float64, where null becomes the zero value and passes a 0..1 range check unharmed. So "the reader's position is unknown" was recorded as "the reader is at the start of the book", four times in a row, and every other device was pulled to the first page. Both halves are fixed, because either alone leaves the other reachable: a client that has not been updated can still post a null, and a server that has not been updated will still take one. Inbound progressions are decoded through their own request struct with a pointer field, so an absent or null value is refused rather than defaulted. The range check is written so that NaN fails it. The response structs keep a plain float64: they are what /v1/heads, /v1/changes and the positions endpoint answer with, and a client reading those has never been able to receive a null. The NaN itself has a cause worth writing down. The paginator derives pages from the container's own bounding rect, so a container that measures zero makes the page count Infinity and the page index NaN, and the fraction computed from the two is NaN for as long as that lasts — which is why four relocate events seventeen seconds apart all carried it, rather than one at startup. A hidden or zero-sized tab is enough. Guarding alone would have traded a wrong position for no position: with nothing finite to push, the reader would simply stop saving its place and never say so. So a non-finite fraction now asks the engine to measure again on a bounded backoff, restarts that when the tab becomes visible, and after the retries are spent tells the reader that syncing is paused rather than leaving them to find out later. The progress bar holds its last good value instead of flashing back to nought. |
||
|---|---|---|
| .. | ||
| adapter | ||
| admin | ||
| api | ||
| auth | ||
| buildinfo | ||
| calibre | ||
| config | ||
| content | ||
| cover | ||
| epub | ||
| infer | ||
| insights | ||
| metadata | ||
| store | ||
| webui | ||
| workident | ||