RouteStorageService.generateId is dead — saveRoute never assigns missing ids #1050

Closed
opened 2026-08-13 05:29:25 +00:00 by spikerj · 1 comment
Owner

RouteStorageService declares a private generateId() (route_ + timestamp + random suffix) but never calls it. saveRoute writes whatever route.id the caller passed; the object store is keyed on id.

Would catch: a GPS recording that forgot to stamp id would hit IndexedDB DataError on put instead of receiving a generated key. The unit suite reaches generateId only via bracket access — production saveRoute still ignores it.

Suggested fix: if !route.id, assign this.generateId() before store.put.

`RouteStorageService` declares a private `generateId()` (`route_` + timestamp + random suffix) but **never calls it**. `saveRoute` writes whatever `route.id` the caller passed; the object store is keyed on `id`. Would catch: a GPS recording that forgot to stamp `id` would hit IndexedDB `DataError` on `put` instead of receiving a generated key. The unit suite reaches `generateId` only via bracket access — production `saveRoute` still ignores it. Suggested fix: if `!route.id`, assign `this.generateId()` before `store.put`.
Author
Owner

Resolved in spikersoft-angular PR #819 (merged to master). saveRoute assigns missing ids via generateId. Closing.

Resolved in spikersoft-angular [PR #819](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/819) (merged to `master`). saveRoute assigns missing ids via generateId. Closing.
Sign in to join this conversation.