feat: unified <UpdateGate> component (v0.3.0)#1
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds a new top-level
<UpdateGate>component that bundlesuseUpdate+<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
thresholds.force→ installed below this triggers the blocking modalthresholds.suggest→ installed below this (but at/aboveforce) triggers the dismissible bannerforce={{ title, message, buttonText }}andsuggest={{ title, position, ... }}pass through customisationshowVersionDiffauto-builds thevX → vYpill on the modalHow I verified
yarn typecheckpasses (strict mode)yarn test— 43 tests pass (10 new for UpdateGate)yarn buildproduces clean lib/ForceUpdateModal,SuggestUpdateBanner,useUpdateexports unchangedBreaking changes
None — additive only. The two-component pattern continues to work for advanced consumers who need per-component theming or layout.