Skip to content
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

Merged
merged 118 commits into from
Sep 24, 2024

Conversation

iqbalalayubbi
Copy link
Collaborator

Describe
Add discard changes button for reset to the previous estimation on edit wheel screen

Demo

discard-changes-button.mp4

iqbalalayubbi and others added 30 commits August 18, 2024 21:49
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@@ -59,13 +68,25 @@ const ScoresEditModal: React.FC<Properties> = ({
[scores, dispatch],
);

const handleDiscardChanges = useCallback(() => {
setScores(originalScoresReference.current);
Copy link
Collaborator

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

Copy link
Collaborator Author

@iqbalalayubbi iqbalalayubbi Sep 24, 2024

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.

Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct me if i wrong, did you mean call the API using the redux like this?

dispatch1

Then get the scores using use app selector
dispatch1

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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?

Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's already handle in use effect
dispatch1

@fshabanov fshabanov merged commit fae7bb2 into main Sep 24, 2024
6 checks passed
@github-actions github-actions bot mentioned this pull request Sep 24, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants