Skip to content

Conversation

@SamMed05
Copy link
Contributor

@SamMed05 SamMed05 commented Nov 2, 2025

I just noticed a bug introduced with the URL params saving feature: when opening a shared URL with algo and processes parameters (e.g., ?algo=SRTF&processes=[...]), the algorithm parameter was being dropped from the URL and the algorithm dropdown remained unselected.

It appears that the URL update effect rebuilt search params from scratch before the form initialized with URL values, causing the algo parameter to be dropped during React hydration. It weirdly wasn't happening when I tested locally, but it's now fixed.

Fix

  • Initialize form with defaultValues that read from URL params synchronously
  • Start URL updates from existing window.location.search instead of empty URLSearchParams
  • Add proper guards and dependency arrays to prevent race conditions
  • Sync selectedAlgorithm state with form value via dedicated effect

It should all work properly now. Take your time to review this, and let me know if you notice any issues.
Thanks for your patience with all the PRs, this should be the last one 😅

@vercel
Copy link

vercel bot commented Nov 2, 2025

@SamMed05 is attempting to deploy a commit to the Kautilya DK's projects Team on Vercel.

A member of the Team first needs to authorize it.

@kautilyadevaraj kautilyadevaraj added the bug Something isn't working label Nov 2, 2025
@kautilyadevaraj
Copy link
Owner

Thank you for noticing this issue. I am sure i would not have caught this any time soon XD.

I have tested it out and it works as expected. I will be merging this.

Thank you for your time and efforts towards this project! I might do a bit of a UI update later on where i will add your name as a contributor on the website. Might not be much but this is all i can do for now XD.

It was a pleasure looking at your code and how you tackled issues. Keep up the good work!

@kautilyadevaraj kautilyadevaraj merged commit 792705a into kautilyadevaraj:master Nov 2, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants