fix(annotations): address code review findings (1-8, 10)

1. toggleVote wrapped in transaction (race condition fix)
2. FeedbackPanel fetch calls now surface errors via onError/toast
3. Extracted resolveBoard/hasCollectionRole to shared board-access.js
4. AnnotationStore uses monotonic version counter for snapshots
5. PinOverlay uses object pool instead of destroy/recreate on refresh
6. canvasObjects prop memoized with useMemo
7. PinOverlay store subscription cleaned up on unmount
8. Comment content capped at 5000 chars (backend validation)
10. anchor_type validated to 'object' or 'point'
This commit is contained in:
Hiren Kangad
2026-03-10 21:16:08 +05:30
parent 303124f518
commit f7a39a1726
9 changed files with 176 additions and 133 deletions
+5
View File
@@ -42,6 +42,10 @@ export class AnnotationStore {
votes = new Map<string, Set<string>>();
private _listeners = new Set<Listener>();
private _version = 0;
/** Monotonic version counter for useSyncExternalStore snapshots */
get version(): number { return this._version; }
subscribe(fn: Listener): () => void {
this._listeners.add(fn);
@@ -49,6 +53,7 @@ export class AnnotationStore {
}
private _notify() {
this._version++;
for (const fn of this._listeners) fn();
}