Pages settings: the live block throws when the project has no active deployment

Summary

On the Pages settings page, the live block throws TypeError: Cannot read properties of null (reading 'active') when the project has no active primary deployment. The error happens on Vue 2 and on Vue 3, with both template compilers, so the Vue 3 migration did not cause it.

Cause

  • deployments.vue passes newestDeployment to live-block. The computed returns null when the query returns no active primary deployment.
  • live-block gets :is-loading="!newestDeployment && $apollo.loading". When loading ends, isLoading becomes false while deployment is still null.
  • live_block.vue declares deployment with default: () => ({}). A default applies only to undefined, not to null.
  • The #title slot then reads deployment.active, and domainName reads this.deployment.url when there is no primary domain. Both throw.

Steps to reproduce

  1. Open Deploy > Pages for a project with Pages that has no active primary deployment, for example after its only deployment is stopped.
  2. Open the browser console.

Expected: the page renders with no error.

Actual: the console shows the TypeError above, and the live block does not render its title.

A Jest spec that mounts live_block.vue with deployment: null and isLoading: false throws the same error.

Possible fixes

  • Render live-block only when there is a deployment (v-if="newestDeployment"). The block says "Your Pages site is live", which is not true without a deployment.
  • Or pass newestDeployment || undefined so the prop default applies, and read the fields with optional chaining.

The owning team should choose what the page shows when no deployment is active.

References

  • Found during #642429. That search ruled this bug out as a compiler regression.
Edited by 🤖 GitLab Bot 🤖