Skip to content

Prevent page refresh if present result is same as result to be searched#1249

Merged
jcscottiii merged 3 commits intoGoogleChrome:mainfrom
suprith-hub:prevent-refresh-search-button-click
Mar 16, 2025
Merged

Prevent page refresh if present result is same as result to be searched#1249
jcscottiii merged 3 commits intoGoogleChrome:mainfrom
suprith-hub:prevent-refresh-search-button-click

Conversation

@suprith-hub
Copy link
Contributor

Hi @jcscottiii, this is a enhancement, addressing the issue: #1237
I am also working to immediately reflect the disabled state(low opacity and hover disable) of search Icon, will be able to make a PR on i soon, also can I do draft PR and ask for assistance?

@jcscottiii
Copy link
Collaborator

Thanks for creating the patch.

Can you instead change this code to use navigateToUrl and change the implementation of navigateToUrl to check if the URL has changed?

@suprith-hub
Copy link
Contributor Author

Ohh ok @jcscottiii , you mean instead of using window.location.href, I should call the navigateToUrl function right?

@suprith-hub suprith-hub force-pushed the prevent-refresh-search-button-click branch from 7016a65 to 4cfe1ca Compare March 11, 2025 03:20
@suprith-hub
Copy link
Contributor Author

@jcscottiii I have made the changes

@suprith-hub
Copy link
Contributor Author

@jcscottiii I have completed the changes...

Copy link
Collaborator

@jcscottiii jcscottiii left a comment

Choose a reason for hiding this comment

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

Apologies for the tardy review on this. Thanks for moving the check inside navigateToUrl. I have some suggestions to make. Then this should be good to go.

Let's move the usage of window.location.origin inside of navigateToUrl.

In the future, I want our formatXxxUrl helpers to return AppLocation instead of string. AppLocation will have things like the search and pathname

Then we can change navigateToUrl to accept AppLocation instead of string. And in navigateToUrl, we can easily assemble the new location.href with something like

const fullNewUrl = window.location.origin + location.pathname + (location.search || '') + (location.hash || '');

@jcscottiii
Copy link
Collaborator

Have you tried running out playwright test suite locally? It seems to be failing. I haven't had a chance to try it yet.

@suprith-hub
Copy link
Contributor Author

suprith-hub commented Mar 16, 2025

Have you tried running out playwright test suite locally? It seems to be failing. I haven't had a chance to try it yet.

@jcscottiii I have tried using the documentation also I tried running the workflow directly.
It always gives this error:
Screenshot from 2025-03-16 11-44-50
I have installed:
Version 1.50.1 what i get on npx playwright --version.
Also npm install which has playwright in node modules
Can you help me out

@jcscottiii
Copy link
Collaborator

Are you able to run this inside the dev container? That should provide the same environment used for development and in CI.

@suprith-hub
Copy link
Contributor Author

Are you able to run this inside the dev container? That should provide the same environment used for development and in CI.

@jcscottiii I was able to run playwright tests in devcontainer. I could not understand how the 3 tests failed in my devcontainer but passed in Github for 2nd time...

@jcscottiii jcscottiii added this pull request to the merge queue Mar 16, 2025
@jcscottiii
Copy link
Collaborator

No worries! I think it was something intermittent going on that was unrelated to your change. I am queueing the pull request now. Thanks for the contribution!

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 16, 2025
@jcscottiii jcscottiii added this pull request to the merge queue Mar 16, 2025
Merged via the queue into GoogleChrome:main with commit 426b3ac Mar 16, 2025
3 checks passed
@jcscottiii jcscottiii mentioned this pull request Mar 20, 2025
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.

2 participants