Skip to content

refactor(webapp): derive controlled UI state during render - #4726

Open
carderne wants to merge 1 commit into
fix/react-compiler-derived-statefrom
fix/react-compiler-effect-state
Open

refactor(webapp): derive controlled UI state during render#4726
carderne wants to merge 1 commit into
fix/react-compiler-derived-statefrom
fix/react-compiler-effect-state

Conversation

@carderne

@carderne carderne commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Derives controlled tab, tag, and checkbox values directly during render instead of copying them through effects. Modal drafts now reset from their open event, and the route-backed alert dialog renders open immediately without a mount-time state update.

@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2af7d20

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d342ec76-83ac-4a38-97b5-b293e8e95d83

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines +70 to +74
// Reset the bundle stepper to the user's current extra-schedules count on each open.
const handleOpenChange = (nextOpen: boolean) => {
if (nextOpen) setBundles(Math.round(extraSchedules / stepSize));
setOpen(nextOpen);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Extra-schedules purchase dialog can show an outdated bundle count

The bundle stepper is now only reset when the dialog is opened (handleOpenChange at apps/webapp/app/components/schedules/PurchaseSchedulesModal.tsx:71-74) and no longer re-syncs while it is open, so a user can see a bundle count that disagrees with the current extra-schedules figure shown right next to it.
Impact: Right after a purchase, reopening the dialog before the refreshed numbers arrive shows a stale bundle count that never corrects itself until the dialog is closed and opened again.

Loss of prop-driven re-sync when extraSchedules/stepSize change while open

The removed effect had [open, extraSchedules, stepSize] as dependencies, so it reset bundles both on open and whenever the props changed (e.g. after the purchase action triggers a loader revalidation that updates extraSchedules). The replacement only resets inside handleOpenChange when nextOpen is true. If the dialog is opened while extraSchedules is still the pre-purchase value and the revalidated value arrives afterwards, bundles (and therefore amountValue) stays stale while the summary section renders the fresh extraSchedules (apps/webapp/app/components/schedules/PurchaseSchedulesModal.tsx:181-213), producing an inconsistent diff/total. A cheap fix is to keep resetting when extraSchedules/stepSize change (e.g. a key-reset or an effect scoped to prop changes) in addition to the on-open reset.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

1 participant