Invental/Review lessons/Client state that goes stale

Client state that goes stale

A paywall bypass also skips the downgrade

A platform flag that skips an entitlement check usually also skips the code that revokes the entitlement: a bypass added to “select” silently disabled “reset on downgrade”, so stale paid state outlived the subscription.

01 · Before and afterThe pattern

Keep entitlement decisions in one derived value and let both the gate and the reset read it.

TypeScript
const canUsePro$ = subscription$.map(s => s?.status === 'active');   // no platform exceptions here
function selectModel(m: Model) { if (m.isPro && !canUsePro$.value) return; selected.set(m.id); }
canUsePro$.subscribe(ok => { if (!ok && current()?.isPro) selected.set(undefined); });
// before: `if (!isIOS && !ok && m.isPro)` in both places, so the reset never ran on iOS

02 · Run it on your appThe check

When a paid plan expires, does every persisted “pro” choice in your app reset, on every platform?

If the honest answer is no or not sure, this is worth a look before it reaches production.

Want this checked on your code?

Tell us what you are building and what worries you. We match a senior reviewer to your code and confirm scope before anything starts.

— Get in touch
hi@invental.co ↗
— Or
— What to include

A link or short description of the code or system, what you want checked, your stack, and when you need the answer. No repository access is needed until scope is agreed.

— Or leave a note
We reply within one business day.