Skip to content

fix: resolve Lit dev warnings from AppKit web components - #5629

Merged
svenvoskamp merged 2 commits into
chore/khizr-fixesfrom
chore/khizr-fixes-REOWN-4559
Apr 13, 2026
Merged

fix: resolve Lit dev warnings from AppKit web components#5629
svenvoskamp merged 2 commits into
chore/khizr-fixesfrom
chore/khizr-fixes-REOWN-4559

Conversation

@Khizr97

@Khizr97 Khizr97 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes 4 Lit development warnings emitted by AppKit internal web components during normal modal usage (REOWN-4559).

Technical Report

Problem

Four Lit dev warnings were firing in the browser console during normal AppKit modal usage, creating noise for developers integrating AppKit.

Root Cause Analysis

Each warning had a distinct cause in a different component:

  1. w3m-wallet-send-view (change-in-update): render() called getMessage() which mutated this.message — a @state() reactive property. Setting reactive state during render triggers a new update cycle.
  2. w3m-input-address (expression-in-textarea): Two <textarea> elements had both .value=\${...} binding AND child expression \${this.value ?? ''}. Lit doesn't support expressions inside <textarea>.
  3. w3m-router-container (change-in-update): updated() lifecycle called onViewChange() which synchronously set this.viewDirection (reactive state), triggering another update during the current cycle.
  4. w3m-all-wallets-list (change-in-update): render() called this.setAttribute('data-mobile-fullscreen', 'true') — DOM mutation during render.

Approach & Reasoning

Fix 1 — Pure function (chosen over computed property):
Converted getMessage() from a state-mutating method to a pure function that returns the message. The return value is passed as a local variable through render() and buttonTemplate(message). Removed the @state() private message property entirely since it was only set and consumed within the same render cycle. The early-return priority order was carefully reversed to match the original last-assignment-wins semantics: SELECT_TOKEN > INCORRECT_VALUE > ADD_AMOUNT > INSUFFICIENT_FUNDS > ADD_ADDRESS > INVALID_ADDRESS > PREVIEW_SEND.

Fix 2 — Remove child expressions (only option):
Removed \${this.value ?? ''} child text from both textarea elements. The .value property binding is the correct and sufficient mechanism for controlling textarea content in Lit. The child text was redundant — it sets defaultValue while .value sets the current value.

Fix 3 — queueMicrotask (chosen over setTimeout/requestAnimationFrame):
Wrapped this.viewDirection = ... in queueMicrotask(). This defers the state mutation past the current Lit update cycle but runs before the next browser paint, so there's no visual gap in the CSS transition animation. setTimeout(0) would run after paint (causing a flash), and requestAnimationFrame could miss the current frame.

Fix 4 — Move to firstUpdated (chosen over willUpdate/updated):
Moved setAttribute to firstUpdated() since mobileFullScreen is initialized from OptionsController.state.enableMobileFullScreen with no subscription — it never changes after init. If it could change dynamically, updated() with a changedProperties check would be needed instead.

Verification

  • 761 scaffold-ui tests pass (1 skipped)
  • All pre-existing type errors only — zero new errors introduced
  • getMessage() priority order verified to match original exactly

Test plan

  • Open AppKit modal in dev mode — no Lit warnings in console
  • Navigate wallet list, send flow, modal views
  • Verify wallet send flow works (address input, amount, preview)
  • Verify modal view transitions animate correctly

🤖 Generated with Claude Code

- w3m-wallet-send-view: make getMessage() a pure function instead of
  mutating @State() inside render()
- w3m-input-address: remove child expressions from textarea elements,
  rely on .value binding only
- w3m-router-container: defer viewDirection mutation via queueMicrotask
  to avoid change-in-update warning from updated()
- w3m-all-wallets-list: move setAttribute() from render() to
  firstUpdated()

Closes REOWN-4559

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@linear

linear Bot commented Apr 9, 2026

Copy link
Copy Markdown

@changeset-bot

changeset-bot Bot commented Apr 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e5e25b8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Apr 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
appkit-demo Building Building Preview, Comment Apr 13, 2026 4:29pm
appkit-gallery Building Building Preview, Comment Apr 13, 2026 4:29pm
appkit-headless-sample-app Ready Ready Preview, Comment Apr 13, 2026 4:29pm
appkit-laboratory Building Building Preview, Comment Apr 13, 2026 4:29pm
9 Skipped Deployments
Project Deployment Actions Updated (UTC)
appkit-basic-example Ignored Ignored Apr 13, 2026 4:29pm
appkit-basic-sign-client-example Ignored Ignored Apr 13, 2026 4:29pm
appkit-basic-up-example Ignored Ignored Apr 13, 2026 4:29pm
appkit-ethers5-bera Ignored Ignored Apr 13, 2026 4:29pm
appkit-nansen-demo Ignored Ignored Apr 13, 2026 4:29pm
appkit-wagmi-cdn-example Ignored Ignored Apr 13, 2026 4:29pm
ethereum-provider-wagmi-example Ignored Ignored Apr 13, 2026 4:29pm
next-wagmi-solana-bitcoin-example Ignored Ignored Apr 13, 2026 4:29pm
vue-wagmi-example Ignored Ignored Apr 13, 2026 4:29pm

Request Review

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Khizr97

Khizr97 commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CTA Document and I hereby sign the CTA

@svenvoskamp
svenvoskamp merged commit 9553f86 into chore/khizr-fixes Apr 13, 2026
14 of 17 checks passed
@svenvoskamp
svenvoskamp deleted the chore/khizr-fixes-REOWN-4559 branch April 13, 2026 16:29
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants