Skip to content

fix(live-preview): skip stackblitz source fetch when no example is set#2248

Merged
spliffone merged 1 commit into
mainfrom
fix/live-preview-stackblitz-undefined-example
Jun 30, 2026
Merged

fix(live-preview): skip stackblitz source fetch when no example is set#2248
spliffone merged 1 commit into
mainfrom
fix/live-preview-stackblitz-undefined-example

Conversation

@chintankavathia

@chintankavathia chintankavathia commented Jun 30, 2026

Copy link
Copy Markdown
Member

Problem

Navigating to the live-preview app root (localhost:4200, which redirects to viewer/editor) produced a runtime console error:

GET http://localhost:4200/app/examples/undefined.ts 404 (Not Found)

Cause

The stackblitz button directive's httpResource built its request URL unconditionally:

private readonly exampleTs = httpResource.text(() => `${this.baseUrl()}${this.example()}.ts`);

When no example was selected, example() is undefined, so the resource fetched app/examples/undefined.ts, returning a 404.

Fix

Return undefined from the request factory when no example is set, which keeps the httpResource idle so no request is made until a real example is selected.

The button remains disabled when there is no example (already handled by !this.example() in the disabled computed).


Documentation.
Examples.
Dashboards Demo.
Playwright report.

Coverage Reports:

Code Coverage

The stackblitz button's httpResource built a request URL unconditionally,
resulting in a 404 GET for app/examples/undefined.ts when no example was
selected (e.g. the default viewer/editor route). Return undefined from the
request factory when no example is set so the resource stays idle.
@chintankavathia chintankavathia requested review from a team as code owners June 30, 2026 06:58

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the SiStackblitzButtonDirective to conditionally fetch the TypeScript example file only when the example is defined, preventing unnecessary HTTP requests when the example value is falsy. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@spliffone spliffone added this pull request to the merge queue Jun 30, 2026
Merged via the queue into main with commit dbba53e Jun 30, 2026
16 checks passed
@spliffone spliffone deleted the fix/live-preview-stackblitz-undefined-example branch June 30, 2026 10:10
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.

2 participants