Skip to content

Alternatives

Design alternatives considered and rejected during implementation (beyond those documented in the architectural exploration).

Upload callback injection (4.x approach vs 5.0.0 context)

Section titled “Upload callback injection (4.x approach vs 5.0.0 context)”
  • Option A (4.x): Three callback props per consumer (onUpload, onUploadFromUrl, onCheckReachability). Each consumer threads them through <ItemCardEditor> and <ImageUploadDialog>.
  • Option B (bridge hook): useItemImageUploadDialog returns three handlers composed from TanStack mutations. Consumers destructure and pass as props. Implemented in 4.11.x.
  • Option C (5.0.0, chosen): Single ImageUploader interface via <ImageUploadProvider> context. Components consume via useImageUploader() hook. Eliminates prop drilling and parallel-implementation drift.

Option A was the initial approach; Option B was a stepping stone. Option C was chosen for 5.0.0 because the three-callback pattern was a leaky abstraction creating coupling between consumer and provider.

  • Cookies only: Simplest but doesn’t work on Amplify preview / localhost (domain mismatch).
  • Signed URLs only: Works everywhere but adds latency (server round-trip per image) and doesn’t cache as effectively.
  • Dual mode (chosen): CdnAuthProvider detects origin and selects the appropriate mode. Zero overhead in production (cookie pass-through), signed URLs only in non-production.
  • AG Grid editable: true + cellEditor: Standard AG Grid approach. Rejected because the Radix-portalled dialog is incompatible with AG Grid’s focus-scope lifecycle (FD-20).
  • Wrapper-scoped dialog (chosen): Grid triggers (double-click / Enter), ItemTableAGGrid owns the dialog lifecycle, commit via applyTransaction. Works reliably with any portalled modal.
  • Always scale by zoom (PR #99 original): Created coordinate-space mismatch with croppedAreaPixels from react-easy-crop.
  • Never scale by zoom (PR #102 first attempt): Lost zoom-only edits (zero pixelCrop path).
  • Two-path: scale only for zero pixelCrop (PR #102 second attempt): Non-zero path still produced unchanged output because croppedAreaPixels at zoom < 1 is the full image rect.
  • Correct approach (tracked in #755): Needs investigation of react-easy-crop’s actual coordinate model at zoom < 1 with realistic image dimensions, not 1x1 mocks.

Copyright: (c) Arda Systems 2025-2026, All rights reserved