@commonpub/layer 0.23.2 → 0.23.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/pages/index.vue +24 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonpub/layer",
3
- "version": "0.23.2",
3
+ "version": "0.23.3",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "files": [
@@ -51,16 +51,16 @@
51
51
  "vue": "^3.4.0",
52
52
  "vue-router": "^4.3.0",
53
53
  "zod": "^4.3.6",
54
- "@commonpub/auth": "0.6.0",
55
54
  "@commonpub/config": "0.15.0",
56
- "@commonpub/editor": "0.7.11",
57
- "@commonpub/explainer": "0.7.15",
58
55
  "@commonpub/docs": "0.6.3",
59
56
  "@commonpub/learning": "0.5.2",
57
+ "@commonpub/editor": "0.7.11",
60
58
  "@commonpub/protocol": "0.12.0",
61
59
  "@commonpub/schema": "0.17.0",
60
+ "@commonpub/server": "2.57.0",
62
61
  "@commonpub/ui": "0.9.0",
63
- "@commonpub/server": "2.57.0"
62
+ "@commonpub/auth": "0.6.0",
63
+ "@commonpub/explainer": "0.7.15"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@testing-library/jest-dom": "^6.9.1",
package/pages/index.vue CHANGED
@@ -14,9 +14,22 @@ const sortedSections = computed(() =>
14
14
  );
15
15
 
16
16
  const { user: authUser } = useAuth();
17
- const { hubs: hubsEnabled, contests: contestsEnabled, learning: learningEnabled, video: videoEnabled, docs: docsEnabled, editorial: editorialEnabled, layoutEngine: layoutEngineEnabled } = useFeatures();
17
+ const { hubs: hubsEnabled, contests: contestsEnabled, learning: learningEnabled, video: videoEnabled, docs: docsEnabled, editorial: editorialEnabled, layoutEngine: layoutEngineFlag } = useFeatures();
18
18
  const { enabledTypeMeta } = useContentTypes();
19
19
 
20
+ // Layout engine path — only active when BOTH the flag is on AND a layout
21
+ // actually exists in the DB for this route. Prevents the "operator enables
22
+ // the flag without seeding a homepage layout → page goes blank" trap
23
+ // (reported by user, session 158 follow-up). When the flag's on but
24
+ // useLayout returns null (feature off OR no published layout for route),
25
+ // we fall through to the configurable/legacy render paths so the user
26
+ // still sees content. Admin can call POST /api/admin/layouts/seed-homepage
27
+ // to populate a default and start using the layout engine for real.
28
+ const { layout: homepageLayout } = useLayout('/');
29
+ const layoutEngineActive = computed(
30
+ () => layoutEngineFlag.value && homepageLayout.value !== null,
31
+ );
32
+
20
33
  const activeTab = ref(authUser.value ? 'foryou' : 'latest');
21
34
  const tabs = computed(() => [
22
35
  { value: 'foryou', label: 'For You', icon: 'fa-solid fa-sparkles' },
@@ -144,15 +157,16 @@ async function handleHubJoin(hubSlug: string): Promise<void> {
144
157
  <template>
145
158
  <div>
146
159
  <!-- ═══ LAYOUT ENGINE (Phase 1c — feature-flagged) ═══
147
- When `features.layoutEngine` is ON, render the homepage via
148
- <LayoutSlot> zones backed by the layouts table. Operators flip
149
- this on AFTER running POST /api/admin/layouts/seed-homepage so
150
- a default layout exists at scope ('route', '/'). If the flag is
151
- on but no layout exists, LayoutSlot renders nothing and the
152
- user sees an empty page — documented at
153
- docs/reference/guides/layout-engine.md. Falls through to the
154
- configurable section renderer when the flag is OFF (default). -->
155
- <template v-if="layoutEngineEnabled">
160
+ Renders DB-driven layout via <LayoutSlot> zones ONLY when BOTH
161
+ (a) features.layoutEngine is ON AND (b) a layout actually exists
162
+ at scope ('route', '/'). Falls through to the configurable or
163
+ legacy renderer otherwise including when the flag's ON but
164
+ no layout has been seeded yet (the "blank page" trap reported
165
+ in session 158 follow-up).
166
+
167
+ To enable for real: POST /api/admin/layouts/seed-homepage,
168
+ then flip the flag. See docs/reference/guides/layout-engine.md. -->
169
+ <template v-if="layoutEngineActive">
156
170
  <LayoutSlot route="/" zone="full-width" />
157
171
  <div class="cpub-main-layout">
158
172
  <main class="cpub-feed-col">