fix(admin): edit button silently fails for items in All Content tab#3284
Draft
fix(admin): edit button silently fails for items in All Content tab#3284
Conversation
editContent() looked up items only in myContent; admin items in the All Content tab come from adminContent, so the find() always returned undefined and the function returned early. Fix: fall back to adminContent with String() ID normalization, async-fetch full content/tags from /api/admin/content/:id (list endpoint omits these fields), and handle the flat committee_slug field on admin list items vs the nested collection.committee_slug shape on myContent items. Closes #2692 https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2692
Admin users clicking "Edit" on blog posts in the All Content tab got no response — the button appeared to do nothing across all browsers.
Root cause:
editContent(id)searched onlymyContent(the user's own posts). Items displayed in the All Content tab come fromadminContent(a separate array populated byGET /api/admin/content). When the ID wasn't inmyContent, the function returned early silently.Fix: Three changes in
editContent:adminContentwithString(c.id) === String(id)(matching the type-safe comparison already used inopenDetailModal)adminContent, async-fetch the full record from/api/admin/content/:idbefore opening the modal — the admin list endpoint omitscontentandtags, which would otherwise render the body editor blank and overwrite the article body on saveitem.committee_slug(flat field on admin list items) as fallback toitem.collection?.committee_slug(nested shape onmyContentitems)Non-breaking justification: Client-side JS fix for a broken UI path; no API, schema, or protocol changes.
Pre-PR review:
contentfield, collection field shape mismatch, ID type coercion) addressed; save path viaPUT /api/me/content/:idconfirmed admin-permissive at server levelopenDetailModal;editFromDetailModalpath unaffected; no new duplicate pathwaysSession: https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}
Generated by Claude Code