Skip to content

Rebuild a theme graph that failed to build - #1349

Merged
clauderic merged 1 commit into
web-components-without-assetsfrom
graph-rebuild-after-error
Oct 20, 2026
Merged

clauderic merged 1 commit into
web-components-without-assetsfrom
graph-rebuild-after-error

Conversation

@clauderic

Copy link
Copy Markdown
Member

Stacked on #1348. Review that one first; this PR's base moves to main once it merges.

What are you adding in this PR?

When a theme graph fails to build, the language server keeps that failure until it restarts.

  • ThemeGraphManager caches each graph as a promise.
  • On a file change, processQueue awaited the cached promise before replacing it. When the build had failed, that await threw, so the graph was never rebuilt.
  • Every later request for references or dependencies got the same error, even after the cause was fixed.

It now still waits for a build in progress, so builds don't overlap, but rebuilds whether that build succeeded or failed.

What's next? Any followup issues?

None.

Tophatting

  • npx vitest run packages/theme-language-server-common/src/server/ThemeGraphManager.spec.ts. The test makes the first build fail on a readDirectory error, then expects a file change to rebuild the graph. Without the fix, the second request rejects with the first build's error.

Before you deploy

  • I included a patch bump changeset
  • My feature is backward compatible

🤖 Generated with Claude Code

ThemeGraphManager caches each graph as a promise. On a file change,
processQueue awaited the cached promise before replacing it. When the
build had failed, that await threw, so the graph was never rebuilt
and every request got the same error until the language server
restarted.

It now still waits for a build in progress, but rebuilds whether that
build succeeded or failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clauderic
clauderic requested a review from a team as a code owner October 20, 2026 13:14
@clauderic
clauderic added this pull request to stack #1353 October 20, 2026 13:15
@clauderic
clauderic merged commit 20f8edf into main Oct 20, 2026
8 checks passed
@clauderic
clauderic deleted the graph-rebuild-after-error branch October 20, 2026 16:28
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.

3 participants