Skip to content

Conversation

@RodrigoFerrari94
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

I am requesting changes because the Increase button logic does not follow the required order of operations and will produce incorrect results and failing tests. In src/App.jsx, the current increase handler checks the old count and may call add100 before addOne, instead of first adding 1 and then checking if the new value is divisible by 5.

Critical issues to fix:

  • In src/App.jsx (within the increase handler), ensure the divisibility check is performed on the value after addOne. The requirement is: invoke addOne, then if the new count is divisible by 5, invoke add100.
  • Suggested approach: use a single functional state update to avoid stale state. For example: set the next value as const next = c + 1 and then return next % 5 === 0 ? next + 100 : next.

What you did well:

  • addOne and add100 correctly use functional updates and the UI wiring for all three buttons is in place.

Minor improvements (optional):

  • Keep the increase logic in one updater for clarity and to prevent order-related bugs; run tests locally to verify the expected sequence.

Once you adjust the increase logic to check the post-increment value, this should meet the spec and pass the tests. Keep going—you're very close!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

I am requesting changes because the increase handler evaluates divisibility against the pre-increment count, which violates the requirement to check after adding 1 and will cause failing tests. In src/App.jsx, the logic after calling addOne() still uses the old count value (see the if (count % 5 === 0) check), so sequences like 101, 102, 103, 104, 105, 206 will not be produced as required.

Critical issue to fix:

  • Update increase to compute the next value first and base the % 5 check on that post-increment value. Use a single functional state update to avoid stale state, e.g., compute next = c + 1 and return next + 100 when next % 5 === 0, otherwise return next.

What you did well:

  • UI renders correctly and addOne/add100 use functional updates and are wired properly.

Once you adjust increase as above, the behavior should match the requirement and tests should pass. Keep going—this is a small but important fix to ensure correct state handling in React.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

src/App.jsx Outdated
Comment on lines 17 to 18
addOne();

Choose a reason for hiding this comment

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

This violates the requirement from the task description: the divisibility check must be performed on the value after adding 1. The current code calls addOne() and then checks if (count % 5 === 0) { ... } — but count here is the pre-increment value, so the conditional is evaluated against the wrong number. See the requirement: "Increase button calls addOne and then, if count is divisible by 5, it additionally calls add100."

To fix this, perform the update in one functional setter to avoid stale state. For example:

setCount(c => {
  const next = c + 1;
  return next % 5 === 0 ? next + 100 : next;
});

This ensures the divisibility check is done on the post-increment value and yields the required sequence (101, 102, 103, 104, 105, 206...).

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Sorry, the pull request review was unsuccessful for the following reasons:

Warning

No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]

If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Sorry, the pull request review was unsuccessful for the following reasons:

Warning

No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]

If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Sorry, the pull request review was unsuccessful for the following reasons:

Warning

No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]

If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Here is my approval to help you keep progressing. Overall, great job: the app renders the title and three buttons, and both addOne and add100 correctly use functional state updates with clear, readable handlers. One key improvement: in src/App.jsx, your increase handler currently checks next % 5 === 0 (post-increment). The requirement and tests expect checking the current count before increment, so starting from 0, clicking Increase should yield 101. To fix this, update the single functional updater to compute next = c + 1 and return c % 5 === 0 ? next + 100 : next (e.g., around the increase function lines where next is defined). This change will align behavior with the test that expects 101 from 0 and should resolve the failing Cypress spec. Nice work keeping updates functional and the UI straightforward—apply this tweak and you’ll be solid.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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