Skip to content

feat(RevenueCatUI): add presentation-session state store (PWENG-57)#3660

Draft
AlvaroBrey wants to merge 3 commits into
alvarobrey/pweng-57-data-layerfrom
alvarobrey/pweng-57-state-store
Draft

feat(RevenueCatUI): add presentation-session state store (PWENG-57)#3660
AlvaroBrey wants to merge 3 commits into
alvarobrey/pweng-57-data-layerfrom
alvarobrey/pweng-57-state-store

Conversation

@AlvaroBrey

@AlvaroBrey AlvaroBrey commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
  • Adds PaywallStateStore, the presentation-session store seeded from the declared state defaults.
  • Workflows share one store across all their screens so state survives navigation.
  • Standalone paywalls keep one store across full refreshes like color changes.
  • Nothing reads or writes it yet, so no behavior change.

AlvaroBrey commented Jun 26, 2026

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): add presentation-session PaywallStateStore feat(RevenueCatUI): add presentation-session state store (PWENG-57) Jun 26, 2026
@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 3925c0f. Configure here.

_workflowState.value = null
if (isNewWorkflowImpression) {
workflowTraceId = UUID.randomUUID().toString()
// Fresh presentation: start the shared store empty; each step registers its declarations as it builds.

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.

Standalone paywall store recreated

Medium Severity

For non-workflow component paywalls, updatePaywallState rebuilds state through calculateState without reusing the existing PaywallStateStore. toComponentsPaywallState then allocates a new store seeded only from declarations, so presentation-session values are lost on color changes and other full state refreshes even though locale-only updates keep the same Components instance.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3925c0f. 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 a932631. The standalone path now reuses one PaywallStateStore (a ViewModel-owned standaloneStateStore, lazily created in updatePaywallState) across full state refreshes like color changes, instead of minting a fresh store each time via toComponentsPaywallState. It is tied to the ViewModel lifetime, so state still resets when the paywall is presented again, matching the workflow-shared store and iOS (@StateObject). Note this was latent in this PR since nothing reads or writes the store until the component wiring lands (Phase 1), but fixing the lifecycle now keeps it correct.

@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 (a970520) to head (a932631).

Additional details and impacted files
@@                       Coverage Diff                       @@
##           alvarobrey/pweng-57-data-layer    #3660   +/-   ##
===============================================================
  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.

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