Skip to content

fix(app): text-shimmer undefined length#16475

Merged
adamdotdevin merged 1 commit intoanomalyco:devfrom
Eric-Guo:fix_text_shimmer_length
Mar 7, 2026
Merged

fix(app): text-shimmer undefined length#16475
adamdotdevin merged 1 commit intoanomalyco:devfrom
Eric-Guo:fix_text_shimmer_length

Conversation

@Eric-Guo
Copy link
Copy Markdown
Contributor

@Eric-Guo Eric-Guo commented Mar 7, 2026

Issue for this PR

Closes #16473

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fix below 500 error in desktop, 100% by Codex.app GPT 5.4

TypeError: Cannot read properties of undefined (reading 'length')
    at Object.fn (http://localhost:3000/@fs/Users/guochunzhong/git/oss/opencode/packages/ui/src/components/text-shimmer.tsx:41:37)
    at runComputation (http://localhost:3000/node_modules/.vite/deps/chunk-VL2SL2GY.js?v=a409caaf:734:22)
    at updateComputation (http://localhost:3000/node_modules/.vite/deps/chunk-VL2SL2GY.js?v=a409caaf:717:3)
    at Object.readSignal (http://localhost:3000/node_modules/.vite/deps/chunk-VL2SL2GY.js?v=a409caaf:650:67)
    at get style (http://localhost:3000/@fs/Users/guochunzhong/git/oss/opencode/packages/ui/src/components/text-shimmer.tsx:64:39)
    at assign (http://localhost:3000/node_modules/.vite/deps/chunk-5C2DUIQJ.js?v=a409caaf:759:24)
    at Object.fn (http://localhost:3000/node_modules/.vite/deps/chunk-5C2DUIQJ.js?v=a409caaf:725:28)
    at runComputation (http://localhost:3000/node_modules/.vite/deps/chunk-VL2SL2GY.js?v=a409caaf:734:22)
    at updateComputation (http://localhost:3000/node_modules/.vite/deps/chunk-VL2SL2GY.js?v=a409caaf:717:3)
    at createRenderEffect (http://localhost:3000/node_modules/.vite/deps/chunk-VL2SL2GY.js?v=a409caaf:236:8)

How did you verify your code works?

It works in my machine.(TM)

Screenshots / recordings

No UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

Copilot AI review requested due to automatic review settings March 7, 2026 13:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a runtime TypeError ("Cannot read properties of undefined (reading 'length')") in the TextShimmer component. The error occurs when props.text is undefined at runtime despite being typed as string, which can happen in SolidJS when the reactive value feeding the prop hasn't resolved yet.

Changes:

  • Wraps props.text in a createMemo with a ?? "" fallback to guard against undefined values
  • Replaces all direct props.text accesses with the safe memoized text() accessor
  • Extracts the shared len computation into its own memo, eliminating duplication between shimmerSize and shimmerDuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@cyberprophet cyberprophet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the more complete fix of the two PRs addressing this bug (the other being #16476).

What's good:

  • Wrapping in createMemo(() => props.text ?? "") is the right SolidJS pattern — the fallback is memoized and reactive, so it only re-evaluates when props.text changes
  • Extracting len into its own memo eliminates the duplicated computation between shimmerSize and shimmerDuration — good cleanup
  • Replacing all props.text references (including aria-label and render slots) with text() is thorough

One minor note: The len memo name is a single word per the project style guide — that's correct. The text memo name is also fine.

Root cause context for reviewers: props.text is typed as string but arrives as undefined at runtime during initial reactive evaluation (e.g. before i18n resolves). This is the same class of bug as #16459 / #16467 in session-header.tsx where current() can be undefined when options() is empty. A fix for that is incoming as a separate PR.

Prefer this PR over #16476 — it's more complete.

@adamdotdevin adamdotdevin merged commit e99d7a4 into anomalyco:dev Mar 7, 2026
16 of 20 checks passed
@Eric-Guo Eric-Guo deleted the fix_text_shimmer_length branch March 11, 2026 02:18
manno23 pushed a commit to manno23/opencode that referenced this pull request Mar 12, 2026
demostanis pushed a commit to demostanis/opencode that referenced this pull request Mar 19, 2026
demostanis pushed a commit to demostanis/opencode that referenced this pull request Mar 20, 2026
balcsida pushed a commit to balcsida/opencode that referenced this pull request Mar 24, 2026
balcsida pushed a commit to balcsida/opencode that referenced this pull request Apr 8, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError in Web UI - Cannot read properties of undefined (reading 'length')

4 participants