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

Issue 476: Sort order toggle button appends value=undefined to URL, breaking the search. #477

Merged
merged 1 commit into from
Dec 15, 2022

Conversation

kaladay
Copy link
Contributor

@kaladay kaladay commented Dec 15, 2022

Description

There are several areas where the is undefined logic can be improved. Fixing these does not solve the problem and such changes have been omitted.

The problem is that the form has an initial value that is undefined. When the form gets submitted, via a search button click or a sort button click, then the undefined gets translated into the string 'undefined'.

The immediate solution is to always initialize the value as an empty string before processing any of the URL arguments on first load.

Fixes #476

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Locally running.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

…reaking the search.

There are several areas where the is undefined logic can be improved.
Fixing these does not solve the problem and such changes have been omitted.

The problem is that the form has an initial value that is undefined.
When the form gets submitted, via a search button click or a sort button click, then the undefined gets translated into the string 'undefined'.

The immediate solution is to always initialize the value as an empty string before processing any of the URL arguments on first load.
@kaladay kaladay requested review from jcreel, jeremythuff and a user December 15, 2022 17:49
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 45.192% when pulling 99f2cd9 on 476-value_undefined into 6956968 on main.

@mumptastic mumptastic self-requested a review December 15, 2022 19:41
kaladay added a commit that referenced this pull request Dec 15, 2022
Remove unused `var i;`.

Add additional checks in case `$scope.discoveryContext.search` does not exist.

The value, when not used must always be set to an empty string as per #476 resolution via PR #477.

Use `angular.isUndefined()` (especiall in place of `!angular.isDefined()`).

Reverse the logic in the `$scope.discoveryContext.ascending ? "ASC" : "DESC"` to using `!$scope.discoveryContext.ascending` to enforce the boolean true/false results.

Make sure to apply the same safety net of checking `$scope.discoveryContext.search` to `$scope.hasSearch()`.
@kaladay kaladay merged commit 620c36b into main Dec 15, 2022
@kaladay kaladay deleted the 476-value_undefined branch December 19, 2022 16:26
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.

Sort order toggle button appends value=undefined to URL, breaking the search.
4 participants