Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having an issue where PrerenderedCardSearch is not showing query data inside embedded/other formats #2163

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"data": {
"type": "card",
"attributes": {
"name": "Super Tech Solutions",
"description": null,
"thumbnailURL": null
},
"relationships": {
"superProjectApp": {
"links": {
"self": "../SuperProjectApp/65cf8a72-61d0-438a-a37a-71b57058aff6"
}
}
},
"meta": {
"adoptsFrom": {
"module": "../super-project/account",
"name": "SuperProjectAccount"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"data": {
"type": "card",
"attributes": {
"title": "Super Project Management",
"description": null,
"thumbnailURL": null
},
"meta": {
"adoptsFrom": {
"module": "../super-project-app",
"name": "SuperProjectApp"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"data": {
"type": "card",
"attributes": {
"name": "Testing Super App Bug",
"description": null,
"thumbnailURL": null
},
"relationships": {
"account": {
"links": {
"self": "../SuperProjectAccount/1d5b6e71-067c-44bf-982e-d41285f5d53f"
}
}
},
"meta": {
"adoptsFrom": {
"module": "../super-project/task",
"name": "SuperProjectTask"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import GlimmerComponent from '@glimmer/component';

import { type CardContext, BaseDef } from 'https://cardstack.com/base/card-api';

import { type Query } from '@cardstack/runtime-common';

import { CardContainer } from '@cardstack/boxel-ui/components';

import { getCards } from '@cardstack/runtime-common';

interface CardListWithoutPrerenderedSignature {
Args: {
query: Query;
realms: URL[];
context?: CardContext;
};
Element: HTMLElement;
}

export class CardListWithoutPrerendered extends GlimmerComponent<CardListWithoutPrerenderedSignature> {
cards = getCards(
() => this.args.query,
() => this.args.realms.map((url) => url.href),
{
isLive: true,
},
);

<template>
<ul class='card-list' ...attributes>
{{#if this.cards.isLoading}}
<div>Loading...</div>
{{else}}
{{#each this.cards.instances as |card|}}
{{#let (getComponent card) as |Component|}}
<li class='card-list-item'>
<CardContainer
{{@context.cardComponentModifier
cardId=card.id
format='data'
fieldType=undefined
fieldName=undefined
}}
class='card'
@displayBoundaries={{true}}
>
<Component @format='embedded' @displayContainer={{false}} />
</CardContainer>
</li>
{{/let}}
{{/each}}
{{/if}}
</ul>
<style scoped>
.card-list {
display: grid;
gap: var(--boxel-sp);
list-style-type: none;
margin: 0;
padding: var(--boxel-sp-6xs);
}
.card-list-item {
display: flex;
flex-wrap: wrap;
gap: var(--boxel-sp) var(--boxel-sp-lg);
}
.card {
height: auto;
min-height: var(--embedded-card-min-height, 345px);
max-width: var(--embedded-card-max-width, 100%);
}
.bordered-items > .card-list-item > * {
border-radius: var(--boxel-border-radius);
box-shadow: inset 0 0 0 1px var(--boxel-light-500);
}
</style>
</template>
}

function getComponent(cardOrField: BaseDef) {
return cardOrField.constructor.getComponent(cardOrField);
}
Loading
Loading