Repository navigation
Conversation
gkhngyk
left a comment
There was a problem hiding this comment.
Functionally this is very close — the singular createTopic trap from #462 is correctly avoided, both buttons are canManage-gated, and the post-add flow (close → refresh → assign-prompts toast) matches the issue exactly. Two small asks before approval:
-
Double-submit guard (real bug): the Input's Enter handler doesn't check
isAdding— the button disables during the await, but pressing Enter again whilecreateTopic+loadDataare in flight runshandleAddTopica second time, and the client-side duplicate check passes becausetopicshasn't refreshed yet → two topics with the same name. One line fixes it:if (isAdding) return;at the top ofhandleAddTopic. -
i18n: this page was wired to next-intl in #517 (your base includes it), so the new strings ("Add Topic", "Create a new topic for this brand.", "Cancel", both toasts) should go through the
topicsnamespace inweb/messages/en.jsonrather than reintroducing hardcoded English to a freshly-wired page.
Everything else is good to go — happy to approve once these two land.
gkhngyk
left a comment
There was a problem hiding this comment.
Both points addressed cleanly — the isAdding guard covers the Enter path and all new strings are in the topics namespace. Thanks! (Non-blocking nit: the input placeholder "e.g. Industry, Comparison..." is the one string still hardcoded — fine to leave for a follow-up.)
Summary
Changes:
createTopic(brandId, name)action.canManagepermission.Related issue
Closes #462
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsChecklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)