Skip to content

Simplify WorkflowTransitionState with explicit from/to step fields#3441

Merged
vegaro merged 1 commit into
mainfrom
cesar/simplify-animating-step-fields
May 7, 2026
Merged

Simplify WorkflowTransitionState with explicit from/to step fields#3441
vegaro merged 1 commit into
mainfrom
cesar/simplify-animating-step-fields

Conversation

@vegaro

@vegaro vegaro commented May 6, 2026

Copy link
Copy Markdown
Member

Cleanup from a review comment on #3430.

visibleStepIds: Set was redundant with animatingFromStepId: String?: the set was always either {from, to} or {to}, derivable from the from/to pair. Replaced both with explicit animatingFromStepId + animatingToStepId. This was there becuase I was attempting some performance improvements in other branch that used a set, but we are going with just from and to for now.

Also dropped some dead code:

  • the unreachable parked-step branch in applyWorkflowTransition (vestige of an old "render all steps" design)
  • the currentStepId param of workflowTransition, now read off state.animatingToStepId

Note

Medium Risk
Moderate risk because it changes which workflow steps are kept in composition and how slide translations are computed, which could cause visual/animation regressions if edge cases exist.

Overview
Simplifies workflow paywall transitions by removing visibleStepIds and making WorkflowTransitionState explicitly track animatingFromStepId and animatingToStepId.

Rendering now only composes the outgoing + incoming steps during a transition (via listOfNotNull(from,to)), and workflowTransition no longer requires currentStepId, instead deriving positioning from state.animatingToStepId. Dead/unused “parked step” translation logic is removed.

Reviewed by Cursor Bugbot for commit 67fadd3. Bugbot is set up for automated code reviews on this repo. Configure here.

… fields

Replace `visibleStepIds: Set<String>` with explicit `animatingFromStepId` and
`animatingToStepId` fields. The set was redundant — its contents were always
derivable from the from/to pair — and a vestige of an earlier "render all
steps" design. Drop the unreachable parked-step branch in `applyWorkflowTransition`
and remove the now-redundant `currentStepId` parameter from `workflowTransition`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vegaro vegaro changed the title refactor: simplify WorkflowTransitionState with explicit from/to step fields Simplify WorkflowTransitionState with explicit from/to step fields May 6, 2026
@codecov

codecov Bot commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.47%. Comparing base (67a763d) to head (67fadd3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3441   +/-   ##
=======================================
  Coverage   79.47%   79.47%           
=======================================
  Files         362      362           
  Lines       14547    14547           
  Branches     1977     1977           
=======================================
  Hits        11561    11561           
  Misses       2190     2190           
  Partials      796      796           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vegaro vegaro marked this pull request as ready for review May 7, 2026 09:20
@vegaro vegaro requested a review from a team as a code owner May 7, 2026 09:20
@vegaro vegaro requested review from facumenzella and tonidero May 7, 2026 09:20

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 67fadd3. Configure here.

componentInteractionTracker = componentInteractionTracker,
)
listOfNotNull(transitionState.animatingFromStepId, transitionState.animatingToStepId)
.forEach { stepId ->

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.

List loses Set deduplication when from equals to

Low Severity

listOfNotNull(transitionState.animatingFromStepId, transitionState.animatingToStepId) can produce duplicate entries if a workflow step's trigger action points back to itself. The old Set-based approach naturally deduplicated this case, rendering the step only once. Now, two composables with the same key would be emitted, both matching the animatingToStepId branch in the when expression (checked first), causing both to animate in simultaneously — a visual glitch. Adding .distinct() to the list would restore the old defensive behavior.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 67fadd3. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not worried about this

clickHandler = clickHandler,
componentInteractionTracker = componentInteractionTracker,
)
listOfNotNull(transitionState.animatingFromStepId, transitionState.animatingToStepId)

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.

I guess this does mean we won't be supporting "peeking" into other pages... But that's probably ok for now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, that's fine. I think at that point we should probably explore horizontal pagers

@vegaro vegaro added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit 3c78985 May 7, 2026
44 checks passed
@vegaro vegaro deleted the cesar/simplify-animating-step-fields branch May 7, 2026 10:04
matteinn pushed a commit to matteinn/purchases-android that referenced this pull request Jun 5, 2026
**This is an automatic release.**

## RevenueCat SDK
### 🐞 Bugfixes
* fix: url encode query prameters (RevenueCat#3451) via Jacob Rakidzich
(@JZDesign)

## RevenueCatUI SDK
### 🐞 Bugfixes
* Fix: dismiss was called before onPurchaseComplete callback invocation
(RevenueCat#3353) via Jacob Rakidzich (@JZDesign)
* Propagate default package across workflow steps (RevenueCat#3431) via Cesar de
la Vega (@vegaro)
### Paywallv2
#### ✨ New Features
* feat: Allow disabling of automatic font scaling (RevenueCat#3438) via Jacob
Rakidzich (@JZDesign)

### 🔄 Other Changes
* Extract `PaywallComponentsImagePreDownloader` (RevenueCat#3448) via Cesar de la
Vega (@vegaro)
* Simplify `WorkflowTransitionState` with explicit from/to step fields
(RevenueCat#3441) via Cesar de la Vega (@vegaro)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk release bookkeeping: primarily flips version strings from
`10.5.0-SNAPSHOT` to `10.5.0` and updates docs/changelogs, with no
functional code changes beyond the reported version constant.
> 
> **Overview**
> Cuts the `10.5.0` release by switching the project from
`10.5.0-SNAPSHOT` to `10.5.0` across build metadata (`.version`,
`gradle.properties`, sample/test app `libs.versions.toml`, and
`Config.frameworkVersion`).
> 
> Updates release artifacts and documentation pointers: CircleCI docs
deploy now syncs the `10.5.0` docs folder to S3, `docs/index.html`
redirects to `10.5.0`, and changelogs are rolled forward with the
`10.5.0` entries in `CHANGELOG.md`/`CHANGELOG.latest.md`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
48537d6. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants