Skip to content

feat(RevenueCatUI): Tab selected-state (PWENG-65)#3664

Draft
AlvaroBrey wants to merge 4 commits into
alvarobrey/pweng-57-resolverfrom
alvarobrey/pweng-65-android-tab-state
Draft

feat(RevenueCatUI): Tab selected-state (PWENG-65)#3664
AlvaroBrey wants to merge 4 commits into
alvarobrey/pweng-57-resolverfrom
alvarobrey/pweng-65-android-tab-state

Conversation

@AlvaroBrey

@AlvaroBrey AlvaroBrey commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

WIP


Note

Medium Risk
Touches broad paywall override resolution and tab UX; behavior is additive with empty-store defaults, but incorrect state keys or updates could change visible paywall content.

Overview
Wires state-driven paywalls so tab selection can drive state_condition overrides across the UI.

Read path: Component state holders (carousel, icon, image, package, stack, tabs, text, timeline, video) now pass PaywallStateStore snapshots into ConditionContext (stateValues / stateDefaults) when resolving overrides, so components can react when store values change.

Write path: TabsComponentStyle carries stateUpdates and each tab has an id (from paywall JSON). TabsComponentView uses a LaunchedEffect on the selected tab id to call stateStore.applyUpdates with a PayloadReference payload (the tab id), seeding on first composition and updating on tab changes.

Style factory maps component.stateUpdates and TabsComponentStyle.Tab(id, stack). Compose UI tests in TabStateTests cover override re-resolution and tab-click publishing.

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

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@AlvaroBrey AlvaroBrey self-assigned this Jun 26, 2026
@AlvaroBrey AlvaroBrey changed the title feat(RevenueCatUI): thread state store into component condition evaluation feat(RevenueCatUI): Tab selected-state (PWENG-65) Jun 26, 2026
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.31%. Comparing base (c7fa19c) to head (d4e83d3).

Additional details and impacted files
@@                      Coverage Diff                      @@
##           alvarobrey/pweng-57-resolver    #3664   +/-   ##
=============================================================
  Coverage                         80.31%   80.31%           
=============================================================
  Files                               384      384           
  Lines                             15729    15729           
  Branches                           2200     2200           
=============================================================
  Hits                              12633    12633           
  Misses                             2218     2218           
  Partials                            878      878           

☔ View full report in Codecov by Harness.
📢 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.

@AlvaroBrey

Copy link
Copy Markdown
Contributor Author

@cursor review

@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 a72ed0e. Configure here.

style.stateUpdates?.takeIf { it.isNotEmpty() }?.let { updates ->
state.stateStore.applyUpdates(updates, payload = JsonPrimitive(selectedTabId))
}
}

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.

Hidden tabs skip store publish

Medium Severity

The LaunchedEffect that publishes the selected tab id via state_updates sits after if (!tabsState.visible) return, so it never runs when the tabs container is hidden. The paywall can still use selectedTabIndex and declaration defaults, but the store may never reflect the active tab id, so sibling components with state_condition overrides can stay on the wrong value.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a72ed0e. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e67faeb. Moved the publish LaunchedEffect above the if (!tabsState.visible) return so a hidden tabs container still publishes its selected tab id. The store is already seeded with the tab key declared default at presentation, so the common case was covered, but this also handles the case where the initial selection (default_tab_id) differs from the declared default. Added a regression test (A hidden tabs component still publishes its selected tab id) where those two differ, so only the publish (not the seed) yields the expected value.

@AlvaroBrey AlvaroBrey force-pushed the alvarobrey/pweng-65-android-tab-state branch from 25b88d2 to d4e83d3 Compare June 26, 2026 14:32
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.

1 participant