-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat(frontend): add discard changes button on edit wheel screen bb-467 #530
feat(frontend): add discard changes button on edit wheel screen bb-467 #530
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
...src/pages/root/components/user-wheel/libs/components/scores-edit-modal/scores-edit-modal.tsx
Outdated
Show resolved
Hide resolved
…4-bebalance into 467-feat-add-discard-changes-button-on-edit-wheel-screen
...src/pages/root/components/user-wheel/libs/components/scores-edit-modal/scores-edit-modal.tsx
Outdated
Show resolved
Hide resolved
…4-bebalance into 467-feat-add-discard-changes-button-on-edit-wheel-screen
...ges/root/components/user-wheel/libs/components/scores-edit-modal/libs/constants/constants.ts
Outdated
Show resolved
Hide resolved
@@ -59,13 +68,25 @@ const ScoresEditModal: React.FC<Properties> = ({ | |||
[scores, dispatch], | |||
); | |||
|
|||
const handleDiscardChanges = useCallback(() => { | |||
setScores(originalScoresReference.current); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to keep a reference. When discarding get the values from Backend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided keep the data using use state. I try to call the api from backend but it has same value. I think because scores state related to each others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure to understand. We don't need to keep this data in state. When you want to discard changes, get the value from the Backend and use that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If yes, I think this can't implement because we have same state. So if we change the scores value with trigger handleSliderChange
function it can be make all of the scores state same value and it can't be reset the value before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set the scores in use effect hook and it work but I don't know that's you mean or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After dispatching the scores, in state we will have saved scores from Backend. Use them to update the slider state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…4-bebalance into 467-feat-add-discard-changes-button-on-edit-wheel-screen
…4-bebalance into 467-feat-add-discard-changes-button-on-edit-wheel-screen
Describe
Add discard changes button for reset to the previous estimation on edit wheel screen
Demo
discard-changes-button.mp4