Skip to content

fix(templates): avoid type cast and add no-cms fallback in FrontendLandingPage#2464

Merged
Maciek Kucmus (mkucmus) merged 4 commits into
mainfrom
fix/landing-page-type-cast
May 28, 2026
Merged

fix(templates): avoid type cast and add no-cms fallback in FrontendLandingPage#2464
Maciek Kucmus (mkucmus) merged 4 commits into
mainfrom
fix/landing-page-type-cast

Conversation

@mkucmus
Copy link
Copy Markdown
Contributor

closes: #1846

Summary

  • Replace as Ref<Schemas["LandingPage"]> cast with a computed() that narrows the type via an explicit throw - addresses #1843 review comment
  • Add a v-else fallback in the template when cmsPage is missing - addresses #1843 review comment
  • Drop the redundant if (landingResponse.value) guard around breadcrumbs (the early throw already handles the null case)
  • Mirror the change in both vue-demo-store and vue-starter-template

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

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

Project Deployment Actions Updated (UTC)
frontends-starter-template-extended Ready Ready Preview, Comment May 28, 2026 8:32am
frontends-vue-starter-template Ready Ready Preview, Comment May 28, 2026 8:32am
old-frontends-demo Ready Ready Preview, Comment May 28, 2026 8:32am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
shopware-frontends-docs Skipped Skipped May 28, 2026 8:32am

Request Review

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 updates the FrontendLandingPage component in both the vue-demo-store and vue-starter-template templates to remove a direct as Ref<Schemas["LandingPage"]> type cast by introducing a computed ref with explicit error throwing, and adds a template fallback when cmsPage is missing.

Changes:

  • Replace the as Ref<Schemas["LandingPage"]> cast with a computed() accessor that throws if data is missing.
  • Add a v-else UI fallback for cases where cmsPage is not present.
  • Simplify breadcrumbs setup by relying on the early “no landingResponse” throw.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
templates/vue-starter-template/app/components/FrontendLandingPage.vue Removes type cast via computed narrowing; adds cmsPage missing fallback UI.
templates/vue-demo-store/app/components/FrontendLandingPage.vue Mirrors the same landing page typing + cmsPage fallback changes in demo store template.

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

Comment on lines +16 to 21
if (!landingResponse.value) {
console.error("[FrontendLandingPage.vue]", error.value?.message);
throw createError({
statusCode: 500,
message: error.value?.message,
});
Comment on lines +26 to +34
const landingPage = computed(() => {
if (!landingResponse.value) {
throw createError({
statusCode: 500,
message: error.value?.message,
});
}
return landingResponse.value;
});
Comment on lines +16 to 21
if (!landingResponse.value) {
console.error("[FrontendLandingPage.vue]", error.value?.message);
throw createError({
statusCode: 500,
message: error.value?.message,
});
Comment on lines +26 to +34
const landingPage = computed(() => {
if (!landingResponse.value) {
throw createError({
statusCode: 500,
message: error.value?.message,
});
}
return landingResponse.value;
});
@mkucmus Maciek Kucmus (mkucmus) merged commit 1d16859 into main May 28, 2026
11 checks passed
@mkucmus Maciek Kucmus (mkucmus) deleted the fix/landing-page-type-cast branch May 28, 2026 12:58
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.

[BUG] FrontendLandingPage.vue check if we can avoid type casting

3 participants