Week 005 — One Bug Closed, One Bug Waiting
The image path problem that ended last week unresolved broke on Tuesday.
Week of October 28, 2024
Progress
The fetch-based item save refactor — which had been stuck on image handling since the previous week — finally resolved on Tuesday. The specific failure: when a brand new image was selected, the form's src attribute held a data blob, not a file path. The FormData.append() call was trying to serialize the entire blob and blowing up. Fixed with a conditional: only append the stored image path when the image is both not-new and not-blank. It works, though the logic threading between all three cases — new image, unchanged image, no image — is harder to read than ideal. Flagged for a future cleanup.
Also added the site header and footer this week. Still unstyled, but navigation scaffolding exists now for the first time. With the item side stable enough to move on from, the focus shifted entirely to users. The users table got created, the profile page started taking shape, and basic CRUD for user records was underway by end of week.
The Hard Part
Getting users started immediately surfaced a new image problem — different from the one just fixed. The profile page needed an avatar, and the same preview/upload pattern used for items was in play. On a second save within the same session, the avatar path was getting cleared. The fix wasn't obvious yet; this one would carry over.
Decision Made
Soft deletes. The question came up while building the delete user flow: instead of removing a record, mark it with a deletion date. From the user's perspective, the account is gone. Internally, the data stays until a scheduled purge runs. Leaves room to change your mind, keeps useful internal data, and doesn't require any complexity beyond a flag. Adopted for both items and users.
Next Week
User CRUD is in progress and the avatar image bug needs a proper root cause analysis. The delete flow works conceptually; the image handling does not.
