Skip to content

Comments

Remove index card to avoid flash of empty cards-grid in host mode#3994

Open
FadhlanR wants to merge 2 commits intomainfrom
cs-10175-remove-index-card
Open

Remove index card to avoid flash of empty cards-grid in host mode#3994
FadhlanR wants to merge 2 commits intomainfrom
cs-10175-remove-index-card

Conversation

@FadhlanR
Copy link
Contributor

@FadhlanR FadhlanR commented Feb 13, 2026

The IndexCard acts as a wrapper that conditionally renders interactHome, hostHome, or cardsGrid based on the current mode/submode context. During prerendering, the mode/submode context is not available, so interactHome and hostHome are never rendered — the template always falls through to the cardsGrid fallback. This causes a flash of empty cards-grid content before the app hydrates and resolves the correct home card. With the upcoming routing MVP, this indirection layer becomes unnecessary. Removing IndexCard simplifies the index card to always be a CardsGrid directly, eliminating the flash and the conditional rendering complexity.

  • Remove IndexCard and make realm index.json files adopt directly from CardsGrid
  • Drop interactHome and hostHome fields from the index card
  • Update realm creation to seed index.json as a CardsGrid instance
  • Add migration script for staging/production environments

@github-actions
Copy link

github-actions bot commented Feb 13, 2026

Host Test Results

    1 files  ±    0      1 suites  ±0   3h 8m 48s ⏱️ + 1h 34m 16s
1 835 tests +  107  1 822 ✅ +  108  13 💤 ± 0  0 ❌ ±0 
3 578 runs  +1 836  3 552 ✅ +1 825  26 💤 +13  0 ❌  - 1 

Results for commit 780aadf. ± Comparison against base commit fcf29c5.

This pull request removes 3 and adds 110 tests. Note that renamed tests count towards both.
Chrome ‑ Acceptance | index card home resolution > host mode: host mode renders hostHome
Chrome ‑ Acceptance | index card home resolution > operator submodes: host submode uses hostHome and updates after edit
Chrome ‑ Acceptance | index card home resolution > operator submodes: interact submode uses interactHome
Chrome ‑ Acceptance | code-submode | field playground > multiple realms: can autogenerate new Spec and field instance (no preexisting Spec)
Chrome ‑ Acceptance | code-submode | field playground > multiple realms: can autogenerate new field instance when spec exists but has no examples
Chrome ‑ Acceptance | code-submode | field playground > multiple realms: can create new field instance (has preexisting Spec)
Chrome ‑ Acceptance | code-submode | field playground > single realm: can autogenerate new Spec and field instance (no preexisting Spec)
Chrome ‑ Acceptance | code-submode | field playground > single realm: can autogenerate new field instance when spec exists but has no examples
Chrome ‑ Acceptance | code-submode | field playground > single realm: can create new field instance (has preexisting Spec)
Chrome ‑ Acceptance | code-submode | field playground > single realm: can not preview non-exports or primitives
Chrome ‑ Acceptance | code-submode | field playground > single realm: can populate instance chooser dropdown options with containedExamples from Spec
Chrome ‑ Acceptance | code-submode | field playground > single realm: can preview compound field instance
Chrome ‑ Acceptance | code-submode | field playground > single realm: can request AI assistant to bulk generate samples
…

♻️ This comment has been updated with latest results.

@FadhlanR FadhlanR marked this pull request as ready for review February 13, 2026 11:05
@FadhlanR FadhlanR requested a review from a team February 13, 2026 11:05
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 780aadfd9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +53 to +57
const updated = {
data: {
type: 'card',
meta: {
adoptsFrom: {

Choose a reason for hiding this comment

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

P1 Badge Preserve index card metadata during migration

This migration rebuilds each matched index.json from a fixed updated object and drops data.attributes entirely, so running in apply mode erases any existing index-card metadata (for example cardInfo.name, cardInfo.summary, or thumbnail values) instead of just removing the obsolete relationship fields. Because CardsGrid still inherits these fields from CardDef, this is destructive data loss for realms that customized their home card metadata.

Useful? React with 👍 / 👎.


// Only process files that adopt from IndexCard
const adoptsFrom = data?.data?.meta?.adoptsFrom;
if (!adoptsFrom || adoptsFrom.name !== 'IndexCard') {

Choose a reason for hiding this comment

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

P2 Badge Limit migration to the base IndexCard module

The migration selector only checks adoptsFrom.name === 'IndexCard' and ignores the module, so any realm-specific card type also named IndexCard will be rewritten to https://cardstack.com/base/cards-grid and have its original shape discarded. For a script intended to scan staging/production trees, this can incorrectly rewrite unrelated custom cards; the predicate should also verify the expected base module before applying changes.

Useful? React with 👍 / 👎.

@FadhlanR FadhlanR changed the title Remove index card to avoid flash of empty cards in host mode Remove index card to avoid flash of empty cards-grid in host mode Feb 13, 2026
@habdelra habdelra requested a review from Copilot February 13, 2026 20:00
Copy link
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 removes the IndexCard wrapper component to eliminate a flash of empty cards-grid during prerendering. The IndexCard previously conditionally rendered different home cards (interactHome, hostHome, or cardsGrid) based on mode/submode context, but this context is not available during prerendering, causing the template to always fall through to cardsGrid. The PR simplifies the architecture by making index cards directly adopt from CardsGrid.

Changes:

  • Removed IndexCard component and replaced it with a backward-compatible export alias to CardsGrid
  • Updated realm creation and setup scripts to seed index.json as CardsGrid instances
  • Added migration script to convert existing IndexCard instances to CardsGrid in production environments

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/migrate-index-to-cards-grid.js New migration script to convert index.json files from IndexCard to CardsGrid adoption
packages/realm-server/server.ts Updated realm creation to generate index.json directly as CardsGrid, removing cards-grid.json creation
packages/realm-server/scripts/setup-submission-realm.sh Updated submission realm setup to create index.json as CardsGrid
packages/realm-server/tests/server-endpoints/maintenance-endpoints-test.ts Updated test expectations for file/instance counts after removing cards-grid.json
packages/host/tests/acceptance/index-home-test.gts Removed test file as interactHome/hostHome functionality no longer exists
packages/experiments-realm/index.json Migrated from IndexCard to CardsGrid adoption
packages/base/index.json Migrated from IndexCard to CardsGrid adoption with relative module path
packages/base/index.gts Replaced IndexCard implementation with backward-compatible export alias
packages/base/cards-grid.json Removed redundant cards-grid.json file
packages/base/cards-grid.gts Simplified query filters to no longer exclude IndexCard
packages/experiments-realm/cards-grid.json Removed redundant cards-grid.json file

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

Comment on lines +52 to +58
// Replace with CardsGrid adoption, strip relationships and attributes
const updated = {
data: {
type: 'card',
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/cards-grid',
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The migration script always uses the absolute module URL 'https://cardstack.com/base/cards-grid', but the manually migrated packages/base/index.json uses the relative path './cards-grid'. This inconsistency means that if this migration script is run on the base realm's index.json, it would change the relative path to an absolute URL. Consider making the script preserve relative paths when the original adoptsFrom uses a relative path (e.g., './index'), or ensure that all migrated files use the same convention (all absolute or all relative based on their context).

Suggested change
// Replace with CardsGrid adoption, strip relationships and attributes
const updated = {
data: {
type: 'card',
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/cards-grid',
// Determine appropriate module path for CardsGrid:
// - preserve relative paths (e.g. "./index" -> "./cards-grid")
// - otherwise use the absolute base URL
const originalModule = adoptsFrom.module;
const cardsGridModule =
typeof originalModule === 'string' && originalModule.startsWith('.')
? './cards-grid'
: 'https://cardstack.com/base/cards-grid';
// Replace with CardsGrid adoption, strip relationships and attributes
const updated = {
data: {
type: 'card',
meta: {
adoptsFrom: {
module: cardsGridModule,

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this only applies to the base index card which will never have this script executed on it, IIUC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, this script will never be executed on base realm.

Copy link
Contributor

@backspace backspace left a comment

Choose a reason for hiding this comment

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

I confess to not being totally sure what the right way through this normalisation is as we move toward host mode routing

Comment on lines +52 to +58
// Replace with CardsGrid adoption, strip relationships and attributes
const updated = {
data: {
type: 'card',
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/cards-grid',
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this only applies to the base index card which will never have this script executed on it, IIUC

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