Fix custom combatant form disappearing when dismissing suggestions
All checks were successful
CI / check (push) Successful in 46s
CI / build-image (push) Successful in 18s

The "Add as custom" button and Escape key were clearing the name input
along with the suggestions, preventing the custom fields (Init, AC,
MaxHP) from ever appearing. Now only the suggestions are dismissed,
keeping the typed name intact so the custom combatant form renders.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-13 17:30:17 +01:00
parent 85acb5c185
commit 07cdd4867a

View File

@@ -284,6 +284,13 @@ export function ActionBar({
setSuggestionIndex(-1); setSuggestionIndex(-1);
}; };
const dismissSuggestions = () => {
setSuggestions([]);
setPcMatches([]);
setQueued(null);
setSuggestionIndex(-1);
};
const confirmQueued = () => { const confirmQueued = () => {
if (!queued) return; if (!queued) return;
for (let i = 0; i < queued.count; i++) { for (let i = 0; i < queued.count; i++) {
@@ -395,7 +402,7 @@ export function ActionBar({
e.preventDefault(); e.preventDefault();
handleEnter(); handleEnter();
} else if (e.key === "Escape") { } else if (e.key === "Escape") {
clearInput(); dismissSuggestions();
} }
}; };
@@ -514,7 +521,7 @@ export function ActionBar({
pcMatches={pcMatches} pcMatches={pcMatches}
suggestionIndex={suggestionIndex} suggestionIndex={suggestionIndex}
queued={queued} queued={queued}
onDismiss={clearInput} onDismiss={dismissSuggestions}
onClickSuggestion={handleClickSuggestion} onClickSuggestion={handleClickSuggestion}
onSetSuggestionIndex={setSuggestionIndex} onSetSuggestionIndex={setSuggestionIndex}
onSetQueued={setQueued} onSetQueued={setQueued}