Skip to content

Stop ScaleWorkers dialog overwriting user input on worker-state update#1

Open
alokrajiv wants to merge 3 commits intomasterfrom
fix/scale-workers-input-glitch
Open

Stop ScaleWorkers dialog overwriting user input on worker-state update#1
alokrajiv wants to merge 3 commits intomasterfrom
fix/scale-workers-input-glitch

Conversation

@alokrajiv
Copy link
Collaborator

Issue:

The "Number of Workers" field was being overwritten by updates from outside the dialog, causing users to lose their manually entered worker count.

Intended UI Fix:

Ensure the user's manually entered worker count is preserved, even when external updates occur.

Code Changes:

  • Implemented useRef for workerCount to keep track of the latest values without triggering re-renders.
  • Updated useEffect to set the initial scaleCount based on the value stored in the ref.

@vercel
Copy link

vercel bot commented Jul 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rakis ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2024 8:29am

Copy link
Owner

@hrishioa hrishioa left a comment

Choose a reason for hiding this comment

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

So this approach works, but maybe it relies on the navbar re-rendering completely to update the state (so if it doesn't the state for workercount becomes stale). Should we useMemo?

@alokrajiv
Copy link
Collaborator Author

@hrishioa oh yes! makes sense..I have pushed another commit.

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