Skip to content

Commit 964fcf0

Browse files
fix(profile-search): prevent form.reset() from clearing first character on input (@AzureNightlock) (#7851)
### Description This PR: Fixes the first character being skipped on input by only clearing the form when the page isn't open. Changes Made: * form.reset() runs only when isOpen is false, Hence clearing the form when the user leaves the page. When the user comes back to the page, the form is cleared instead of clearing when the user first enters the page Additional Changes Made: * Removed the unused catch parameter ("e") from onChangeAsync. * showIndicator doesn't show up when the field is blank ### Checks - [x] Check if any open issues are related to this PR; if so, be sure to tag them below. - [x] Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info) - [x] Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title. Closes #7850 Co-authored-by: Christian Fehmer <fehmer@users.noreply.github.com>
1 parent 2f7b439 commit 964fcf0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

frontend/src/ts/components/pages/profile/ProfileSearchPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ export function ProfileSearchPage(): JSXElement {
4242

4343
createEffect(() => {
4444
if (isOpen()) {
45-
form.reset();
4645
requestAnimationFrame(() => {
4746
inputEl()?.qs("input")?.focus({ preventScroll: true });
4847
});
48+
} else {
49+
form.reset();
4950
}
5051
});
5152

@@ -77,7 +78,7 @@ export function ProfileSearchPage(): JSXElement {
7778
getUserProfile(field.value),
7879
);
7980
return result !== null ? undefined : "Unknown user";
80-
} catch (e) {
81+
} catch {
8182
return "Unknown user";
8283
}
8384
},

0 commit comments

Comments
 (0)