Skip to content

feat: unified <UpdateGate> component (v0.3.0)#1

Merged
himanshu-zethic merged 1 commit into
mainfrom
feat/update-gate-unified-component
May 18, 2026
Merged

feat: unified <UpdateGate> component (v0.3.0)#1
himanshu-zethic merged 1 commit into
mainfrom
feat/update-gate-unified-component

Conversation

@himanshu-zethic
Copy link
Copy Markdown
Collaborator

What this PR does

Adds a new top-level <UpdateGate> component that bundles useUpdate + <ForceUpdateModal> + <SuggestUpdateBanner> behind a single API.

Why

User feedback: rendering two separate components with verdict-routing in app code is boilerplate the library should hide.

API

<UpdateGate
  installed={DeviceInfo.getVersion()}
  thresholds={{
    force: serverConfig.min_app_version,
    suggest: serverConfig.latest_app_version,
  }}
  accent="#FF6B6B"
/>
  • thresholds.force → installed below this triggers the blocking modal
  • thresholds.suggest → installed below this (but at/above force) triggers the dismissible banner
  • force={{ title, message, buttonText }} and suggest={{ title, position, ... }} pass through customisation
  • showVersionDiff auto-builds the vX → vY pill on the modal

How I verified

  • yarn typecheck passes (strict mode)
  • yarn test — 43 tests pass (10 new for UpdateGate)
  • yarn build produces clean lib/
  • No breaking changes — existing ForceUpdateModal, SuggestUpdateBanner, useUpdate exports unchanged
  • CHANGELOG updated, version bumped to 0.3.0
  • README hero rewritten with the new simpler API

Breaking changes

None — additive only. The two-component pattern continues to work for advanced consumers who need per-component theming or layout.

Adds a high-level component that wraps useUpdate + ForceUpdateModal +
SuggestUpdateBanner so consumers can integrate with three props instead of
six lines of verdict-routing boilerplate.

  <UpdateGate
    installed={DeviceInfo.getVersion()}
    thresholds={{
      force: serverConfig.min_app_version,
      suggest: serverConfig.latest_app_version,
    }}
    accent="#FF6B6B"
  />

- `thresholds` prop groups force/suggest version cutoffs — the relationship
  is unmistakable
- `force` and `suggest` prop bags forward customisation to the inner
  modal/banner without prop-pollution at the top level
- `showVersionDiff` auto-generates the "vX → vY" pill on the modal
- No breaking changes — lower-level exports continue to work

Co-authored-by: Claude <noreply@anthropic.com>
@himanshu-zethic himanshu-zethic merged commit 6cfbfce into main May 18, 2026
1 check passed
@himanshu-zethic himanshu-zethic deleted the feat/update-gate-unified-component branch May 18, 2026 08:03
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.

1 participant