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 search functionality to prevent full page reload #455

Merged
merged 3 commits into from
Feb 6, 2025

Conversation

jrhoads
Copy link
Contributor

@jrhoads jrhoads commented Feb 6, 2025

Purpose

Addresses issue #454: Search Functionality Causing Full Page Reload and React Query Cache Invalidation

The PR aims to improve the search experience across different search types (works, people, organizations, and repositories) by optimizing the search functionality and preventing unnecessary page reloads.

Approach

The changes focus on enhancing the search component's behavior and ensuring a smoother user experience:

  • Added an effect to synchronize search input with URL parameters
  • Modified search function to prevent default form submission
  • Adjusted debounce delay for more responsive search
  • Updated page component naming for clarity
  • Removed unnecessary console.log

Key Modifications

  • Added useEffect to update search input when URL changes
  • Increased debounce delay from 300ms to 500ms
  • Prevented default form submission in search button
  • Renamed SearchDoiPage to SearchOrganizationPage
  • Removed debug logging in organization search query

Important Technical Details

  • Handles browser back/forward navigation scenarios
  • Improves search input synchronization
  • Reduces unnecessary page reloads

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

@jrhoads jrhoads self-assigned this Feb 6, 2025
@jrhoads jrhoads requested review from bklaing2, codycooperross and a team February 6, 2025 10:37
Copy link

cypress bot commented Feb 6, 2025

akita    Run #1550

Run Properties:  status check passed Passed #1550  •  git commit c85f37d07c ℹ️: Merge bb9444a1852ad42aa3267896194278b4c401dec2 into 277ecb055f23ff2ae624b6dc12a3...
Project akita
Branch Review bugfix/prevent-search-reload
Run status status check passed Passed #1550
Run duration 01m 45s
Commit git commit c85f37d07c ℹ️: Merge bb9444a1852ad42aa3267896194278b4c401dec2 into 277ecb055f23ff2ae624b6dc12a3...
Committer Joseph Rhoads
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 50
View all changes introduced in this branch ↗︎

@codycooperross
Copy link
Contributor

codycooperross commented Feb 6, 2025

I love this and have been meaning to ask if this is something we could smooth out. Great job, @jrhoads ! Looks really good in my testing.

@jrhoads jrhoads merged commit 5b06222 into master Feb 6, 2025
12 checks passed
@jrhoads jrhoads deleted the bugfix/prevent-search-reload branch February 6, 2025 11:34
Copy link

cypress bot commented Feb 6, 2025

akita    Run #1552

Run Properties:  status check passed Passed #1552  •  git commit 5b06222820: Merge pull request #455 from datacite/bugfix/prevent-search-reload
Project akita
Branch Review 1.20.0
Run status status check passed Passed #1552
Run duration 01m 42s
Commit git commit 5b06222820: Merge pull request #455 from datacite/bugfix/prevent-search-reload
Committer Joseph Rhoads
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 50
View all changes introduced in this branch ↗︎

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