Skip to content

tag_metadata#231

Merged
tenkus47 merged 1 commit into
devfrom
tag-metadata
Jun 19, 2026
Merged

tag_metadata#231
tenkus47 merged 1 commit into
devfrom
tag-metadata

Conversation

@Lungsangg

Copy link
Copy Markdown
Member

No description provided.

@Lungsangg Lungsangg requested a review from tenkus47 June 18, 2026 11:48
@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown

Confidence Score: 3/5

Merging carries a real risk of data loss for any tag created before this change — opening and saving such a tag in the edit dialog will submit empty metadata instead of preserving the existing name and description.

The edit-form fallback for legacy tags initialises all language fields to empty strings rather than seeding them from tag.name and tag.description. Any user who opens and saves one of those older tags will silently overwrite valid data with an empty payload.

src/components/routes/tags/TagFormDialog.tsx — the else branch in the useEffect that populates form state when tag.metadata is empty.

Reviews (1): Last reviewed commit: "tag_metadata" | Re-trigger Greptile

Comment on lines +73 to +80
} else {
setActiveLanguages(["EN"]);
setLanguageData({
EN: { name: "", description: "" },
BO: { name: "", description: "" },
ZH: { name: "", description: "" },
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Edit form shows blank fields for legacy tags

When opening the edit dialog for a tag that was created before the metadata migration — where tag.metadata is empty but tag.name and tag.description still hold valid data — the else branch resets all language inputs to empty strings. A user editing such a tag would see a blank form, and submitting it would overwrite the existing name/description with empty metadata. The fallback should seed the EN block from tag.name and tag.description.

Suggested change
} else {
setActiveLanguages(["EN"]);
setLanguageData({
EN: { name: "", description: "" },
BO: { name: "", description: "" },
ZH: { name: "", description: "" },
});
}
} else {
setActiveLanguages(["EN"]);
setLanguageData({
EN: { name: tag?.name ?? "", description: tag?.description ?? "" },
BO: { name: "", description: "" },
ZH: { name: "", description: "" },
});
}

Comment on lines +33 to +36
interface LanguageData {
name: string;
description: string;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Duplicated LanguageData interface

An identical LanguageData interface is declared in both this file and TagFormDialog.tsx. Keeping two copies means future changes to the shape must be made in both places. Consider extracting it alongside TagMetadataInput in tagsApi.ts (or a shared types file) so both components import the same definition.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@tenkus47 tenkus47 merged commit 71c3eec into dev Jun 19, 2026
2 of 3 checks passed
@tenkus47 tenkus47 deleted the tag-metadata branch June 19, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants