fix(widget): refit amount text when its container resizes - #890
Open
BiscuitCoder wants to merge 1 commit into
Open
BiscuitCoder wants to merge 1 commit into
BiscuitCoder wants to merge 1 commit into
Conversation
BiscuitCoder
force-pushed
the
codex/resize-amount-text
branch
from
September 29, 2026 15:16
ab596ce to
e78a0de
Compare
🦋 Changeset detectedLatest commit: e78a0de The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
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.
Which Linear task is linked to this PR?
No Linear task; external bug-fix contribution.
Why was it implemented this way?
The send and receive amount cards fit their text only when the displayed value changes. If an embedding container becomes narrower while the amount stays the same, the old font size remains: the input clips its value and the receive text can overflow into the token selector. Growing the container again also leaves previously reduced text unnecessarily small.
Observe each amount element with
ResizeObserverand reuse the existingfitInputTextcalculation. Keep the initial/value-change fit and disconnect each observer when the effect is replaced or the card unmounts. The receive effect also depends onshowSkeleton, so it attaches when a loading placeholder is replaced by an amount with the same display value.No layout, font limits, public API or dependencies change. Includes a Widget patch changeset.
Validation:
Visual showcase (Screenshots or Videos)
Keep
123456789012unchanged and resize the host from 480px to 300px, then back. In the isolated card fixture, the amount element's available width changes from 342px to 162px:The displayed amount stays unchanged throughout.
Checklist before requesting a review