Skip to content

Commit c6e775c

Browse files
committed
fix(app-shell): load the bundle only for the app the URL names; verdict transports answer the bundle
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzFu8iUogiZhxL9tAo
1 parent 1f8915d commit c6e775c

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎ui/packages/app-shell/src/console/AppContent.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,9 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
390390
// objectstack#27627 — entering an app loads its metadata bundle, and
391391
// re-entering it revalidates the one held (`loadAppBundle`): from then on the
392392
// by-name metadata reads of everything the app reaches are answered from it.
393+
// Only the app the URL names: a pseudo-route's fallback app is not entered.
393394
// A host adapter without the bundle keeps every by-name read.
394-
const bundleAppName: string | undefined = typeof activeApp?.name === 'string' ? activeApp.name : undefined;
395+
const bundleAppName: string | undefined = typeof matchedApp?.name === 'string' ? matchedApp.name : undefined;
395396
useEffect(() => {
396397
const load = dataSource?.loadAppBundle;
397398
if (!bundleAppName || typeof load !== 'function') return;

‎ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ function makeAdapter() {
212212
if (url.includes('/api/v1/discovery')) {
213213
return json(200, { success: true, data: { version: 'v0', routes: {}, capabilities: {} } });
214214
}
215+
// objectstack#27627 — entering an app loads its metadata bundle; that is
216+
// not the by-name read this file asks about, and it answers as refused.
217+
if (/\/api\/v1\/meta\/app\/[^/?]+\/bundle$/.test(url)) return json(404, ABSENT_BODY);
215218
const item = /\/api\/v1\/meta\/app\/([^/?]+)/.exec(url);
216219
if (item) {
217220
metaItemRequests.push(url);

‎ui/packages/app-shell/src/console/__tests__/AppContent.settingsMarketplaceVerdict-27507.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ function makeAdapter() {
147147
if (url.includes('/api/v1/discovery')) {
148148
return json(200, { success: true, data: { version: 'v0', routes: {}, capabilities: {} } });
149149
}
150+
// objectstack#27627 — entering an app loads its metadata bundle; that is
151+
// not the by-name read this file asks about, and it answers as refused.
152+
if (/\/api\/v1\/meta\/app\/[^/?]+\/bundle$/.test(url)) return json(404, ABSENT_BODY);
150153
const item = /\/api\/v1\/meta\/app\/([^/?]+)/.exec(url);
151154
if (item) {
152155
metaItemRequests.push(url);

‎ui/packages/app-shell/src/console/__tests__/AppContent.setupItemRoutesVerdict-12706.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ function makeAdapter() {
163163
if (url.includes('/api/v1/discovery')) {
164164
return json(200, { success: true, data: { version: 'v0', routes: {}, capabilities: {} } });
165165
}
166+
// objectstack#27627 — entering an app loads its metadata bundle; that is
167+
// not the by-name read this file asks about, and it answers as refused.
168+
if (/\/api\/v1\/meta\/app\/[^/?]+\/bundle$/.test(url)) return json(404, ABSENT_BODY);
166169
const item = /\/api\/v1\/meta\/app\/([^/?]+)/.exec(url);
167170
if (item) {
168171
metaItemRequests.push(url);

‎ui/packages/data-objectstack/src/appBundle-27627.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ const task = { name: 'b27627_task', label: 'Task', fields: { contact: { type: 'l
8282

8383
/** The bundle's answer: bare, every member the envelope its by-name read answers. */
8484
function bundle(label = 'Contact') {
85-
const env = (type: string, item: { name: string }, extra: Record<string, unknown> = {}) => ({ type, name: item.name, item, ...extra });
85+
const env = (type: string, item: { name: string; [key: string]: unknown }, extra: Record<string, unknown> = {}) => ({ type, name: item.name, item, ...extra });
8686
return {
8787
app: env('app', { name: APP, label: 'App' }),
8888
objects: [
8989
env('object', { ...contact, label }, { sortability: { fields: { name: { sortable: true } } } }),
9090
env('object', task),
9191
],
92-
views: [env('view', { name: 'b27627_contact.all', object: 'b27627_contact', label: 'All' } as { name: string })],
93-
pages: [env('page', { name: 'b27627_contact_page', label: 'Contact page' } as { name: string })],
94-
dashboards: [env('dashboard', { name: 'b27627_home', label: 'Home' } as { name: string })],
92+
views: [env('view', { name: 'b27627_contact.all', object: 'b27627_contact', label: 'All' })],
93+
pages: [env('page', { name: 'b27627_contact_page', label: 'Contact page' })],
94+
dashboards: [env('dashboard', { name: 'b27627_home', label: 'Home' })],
9595
};
9696
}
9797

0 commit comments

Comments
 (0)