Skip to content

fix(adapty-ui): render product text on first composition before produ…#45

Open
Taha-Firoz wants to merge 2 commits into
adaptyteam:masterfrom
TheRandonauts:master
Open

fix(adapty-ui): render product text on first composition before produ…#45
Taha-Firoz wants to merge 2 commits into
adaptyteam:masterfrom
TheRandonauts:master

Conversation

@Taha-Firoz
Copy link
Copy Markdown

TextResolver.resolve returned StringWrapper.EMPTY whenever products[desiredProductId] was null, which blanked the Purchase Button label (and Products text) on the first launch of an Android paywall, even for literal labels with no product-dependent tags. The label only appeared after dismissing and reopening, once the SDK had cached the products.

Match the iOS path (AdaptyUITextView's placeholder branch): drop the early return and let the resolver continue with a nullable product. The default-payment-mode lookup returns the configured text immediately, and recomposition fills in tag-resolved values once products arrive.

…cts load

TextResolver.resolve returned StringWrapper.EMPTY whenever products[desiredProductId] was null, which blanked the Purchase Button label (and Products text) on the first opening of an Android paywall, even for literal labels with no product-dependent tags. The label only appeared after dismissing and reopening, once the SDK had cached the products.

Match the iOS path (AdaptyUITextView's placeholder branch): drop the early return and let the resolver continue with a nullable product. The default-payment-mode lookup returns the configured text immediately, and recomposition fills in tag-resolved values once products arrive.
@vladd-g
Copy link
Copy Markdown
Contributor

vladd-g commented May 7, 2026

Hi @Taha-Firoz, thank you for your contribution! We’ll review it and I’ll get back to you soon.

@Taha-Firoz
Copy link
Copy Markdown
Author

I'll be adding another commit, the purchase button doesn't involve the payment tray reliably either.

ViewModelProvider was keyed only by class name, so every AdaptyPaywallView in the same Activity received the same PaywallViewModel. Android fires attach listeners after AbstractComposeView creates and runs its initial composition, so the first frame of a freshly attached AdaptyPaywallView read the shared VM's stale dataState.value (the previous paywall's UserArgs) before setNewData() ran, rendering the prior paywall's tree and corrupting state[group_*] with its productId. The next Buy Now tap then silently no-oped because the lookup hit a product not present in the new paywall's products map.
Pass a per-instance UUID as the ViewModelProvider key so each view gets its own VM.
@Taha-Firoz
Copy link
Copy Markdown
Author

Taha-Firoz commented May 9, 2026

When the host opens different paywalls in the same Activity, the second paywall rendered the previous
paywall's tree on its first composition and silently dropped the next Buy Now tap.

@vladd-g
Copy link
Copy Markdown
Contributor

vladd-g commented May 9, 2026

@Taha-Firoz thank you, we're taking a look.

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