Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not allow search submit if no terms entered #446

Merged
merged 1 commit into from
Oct 19, 2023
Merged

Conversation

katiestahl
Copy link
Contributor

@katiestahl katiestahl commented Oct 19, 2023

close #415

@@ -104,6 +104,9 @@ const SearchBar: React.FC<SearchBarProps> = ({ handleSubmit }) => {
}
};
const handleSearchClick = () => {
if (selectedOptions?.length === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was wondering if selectedOptions could be undefined and that would then cause this to be false and submit the form anyways, but it looks like its always set to [] as far as I can tell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, its default is always [] if the state is never changed! as long as no one ever changes any of the setSelectedOptions([]) to something other than [], we should be in the clear! Another potential issue could be if event.target.value is ever undefined... I don't see how that could happen unless there was some sort of data issue with the search suggestions, though.

@katiestahl katiestahl merged commit 1fdcb19 into dev Oct 19, 2023
5 checks passed
@katiestahl katiestahl deleted the issue-415 branch October 19, 2023 14:04
katiestahl added a commit that referenced this pull request Oct 19, 2023
* fix: use correct indication attribute name (#408)

* fix: add URL cites back (#409)

* add release information component for footer

* run prettier

* cleanup: make about links consistent (#413)

* make footer no longer sticky

* fix: correct source versioning (#421)

* fix: clean up GtoP import (#419)

* fix: use latest GO address (#424)

* feat: bump drugbank version (#422)

* feat: alphabetize sources

* refactor: alphabetize sources

* style: running prettier to prettify the sort data function

* fix: sort on pmid and source columns

* feat: add sources to interaction page

* feat: reduce precision of interaction score on interaction page to 2 decimal places

* fix: fix typo (#444)

* fix: do not allow search submit if no terms entered (#446)

---------

Co-authored-by: James Stevenson <james.stevenson@nationwidechildrens.org>
Co-authored-by: Adam Coffman <acoffman@wustl.edu>
katiestahl added a commit that referenced this pull request Oct 19, 2023
* disable strict build in github actions for now

* set variable directly in build command

* Automated frontend build

* remove key entries if nil

* auth differently when CI is set

* add libraries required for ssh auth

* removing stale file

* Automated frontend build

* Dev (#442)

* fix: use correct indication attribute name (#408)

* fix: add URL cites back (#409)

* add release information component for footer

* run prettier

* cleanup: make about links consistent (#413)

* make footer no longer sticky

* fix: correct source versioning (#421)

* fix: clean up GtoP import (#419)

* fix: use latest GO address (#424)

* feat: bump drugbank version (#422)

* feat: alphabetize sources

* refactor: alphabetize sources

* style: running prettier to prettify the sort data function

* fix: sort on pmid and source columns

* feat: add sources to interaction page

* feat: reduce precision of interaction score on interaction page to 2 decimal places

---------

Co-authored-by: James Stevenson <james.stevenson@nationwidechildrens.org>
Co-authored-by: Adam Coffman <acoffman@wustl.edu>

* Automated frontend build

* Dev (#447)

* fix: use correct indication attribute name (#408)

* fix: add URL cites back (#409)

* add release information component for footer

* run prettier

* cleanup: make about links consistent (#413)

* make footer no longer sticky

* fix: correct source versioning (#421)

* fix: clean up GtoP import (#419)

* fix: use latest GO address (#424)

* feat: bump drugbank version (#422)

* feat: alphabetize sources

* refactor: alphabetize sources

* style: running prettier to prettify the sort data function

* fix: sort on pmid and source columns

* feat: add sources to interaction page

* feat: reduce precision of interaction score on interaction page to 2 decimal places

* fix: fix typo (#444)

* fix: do not allow search submit if no terms entered (#446)

---------

Co-authored-by: James Stevenson <james.stevenson@nationwidechildrens.org>
Co-authored-by: Adam Coffman <acoffman@wustl.edu>

* Automated frontend build

* Automated frontend build

---------

Co-authored-by: Adam Coffman <acoffman@wustl.edu>
Co-authored-by: acoffman <acoffman@users.noreply.github.com>
Co-authored-by: katiestahl <katiestahl@users.noreply.github.com>
Co-authored-by: James Stevenson <james.stevenson@nationwidechildrens.org>
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.

3 participants