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

Fix pre-rendered spec card icon #2254

Merged
merged 7 commits into from
Mar 14, 2025
Merged

Conversation

FadhlanR
Copy link
Contributor

This is the minimal solution to fix the bug where the pre-rendered spec card displays a loading state as its icon. In this PR, we use the spec card's own card type icon as the icon for the pre-rendered spec card.

Screen.Recording.2025-03-10.at.12.11.25.mov


export type SpecType = 'card' | 'field' | 'app' | 'skill';

class SpecTypeField extends StringField {
static displayName = 'Spec Type';
}

class Isolated extends Component<typeof Spec> {
@tracked icon: CardOrFieldTypeIcon | undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to move out the Isolated, Fitted, and Edit views to satisfy the type check since I use @tracked.

@FadhlanR FadhlanR requested review from tintinthong and a team March 10, 2025 05:21
Copy link

github-actions bot commented Mar 10, 2025

Host Test Results

    1 files  ±  0      1 suites  ±0   26m 14s ⏱️ + 1m 5s
827 tests +24  824 ✔️ +23  3 💤 +1  0 ±0 
832 runs  +24  829 ✔️ +23  3 💤 +1  0 ±0 

Results for commit 13f6838. ± Comparison against base commit 40ad332.

This pull request removes 803 and adds 827 tests. Note that renamed tests count towards both.
Chrome 133.0 ‑ Acceptance | AI Assistant tests: attaches a card in a conversation multiple times
Chrome 133.0 ‑ Acceptance | AI Assistant tests: auto-attached file is not displayed in interact mode
Chrome 133.0 ‑ Acceptance | AI Assistant tests: can display and remove auto attached file
Chrome 133.0 ‑ Acceptance | AI Assistant tests: can open attach file modal
Chrome 133.0 ‑ Acceptance | AI Assistant tests: defaults to anthropic/claude-3.5-sonnet in code mode
Chrome 133.0 ‑ Acceptance | AI Assistant tests: displays active LLM in chat input
Chrome 133.0 ‑ Acceptance | Commands tests > suspending global error hook: a command that errors when executing allows retry
Chrome 133.0 ‑ Acceptance | Commands tests: OpenAiAssistantRoomCommand opens the AI assistant room
Chrome 133.0 ‑ Acceptance | Commands tests: a command added from a skill can be executed when clicked on
Chrome 133.0 ‑ Acceptance | Commands tests: a command executed via the AI Assistant shows the result as an embedded card
…
Chrome 134.0 ‑ Acceptance | AI Assistant tests: attaches a card in a conversation multiple times
Chrome 134.0 ‑ Acceptance | AI Assistant tests: auto-attached file is not displayed in interact mode
Chrome 134.0 ‑ Acceptance | AI Assistant tests: can display and remove auto attached file
Chrome 134.0 ‑ Acceptance | AI Assistant tests: can open attach file modal
Chrome 134.0 ‑ Acceptance | AI Assistant tests: defaults to anthropic/claude-3.5-sonnet in code mode
Chrome 134.0 ‑ Acceptance | AI Assistant tests: displays active LLM in chat input
Chrome 134.0 ‑ Acceptance | Commands tests > suspending global error hook: a command that errors when executing allows retry
Chrome 134.0 ‑ Acceptance | Commands tests: OpenAiAssistantRoomCommand opens the AI assistant room
Chrome 134.0 ‑ Acceptance | Commands tests: ShowCard command added from a skill, can be executed when clicked on
Chrome 134.0 ‑ Acceptance | Commands tests: a command added from a skill can be executed when clicked on
…
This pull request removes 2 skipped tests and adds 3 skipped tests. Note that renamed tests count towards both.
Chrome 133.0 ‑ Integration | card-editor: can create a specialized a new card to populate a linksTo field
Chrome 133.0 ‑ Integration | create app module via ai-assistant: it can create a module using a tool call
Chrome 134.0 ‑ Integration | card-editor: can create a specialized a new card to populate a linksTo field
Chrome 134.0 ‑ Integration | commands | apply-search-replace-block: handles malformed search/replace block
Chrome 134.0 ‑ Integration | create app module via ai-assistant: it can create a module using a tool call

♻️ This comment has been updated with latest results.

this.loadCardIcon.perform();
}

private loadCardIcon = restartableTask(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is only ever called once in the constructor, there is no reason for it to be a restartableTask. It should just be a task.

Copy link
Contributor

Choose a reason for hiding this comment

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

On that topic, perhaps this task should be executed again if the ref changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used resource instead, so it will be reload if the value of ref is updated.

this.loadCardIcon.perform();
}

private loadCardIcon = restartableTask(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same note

this.loadCardIcon.perform();
}

private loadCardIcon = restartableTask(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same note

@FadhlanR FadhlanR force-pushed the cs-8118-fix-prerendered-spec-card-icon branch from da8eb7e to bde2119 Compare March 11, 2025 08:34
@FadhlanR FadhlanR requested a review from lukemelia March 11, 2025 14:43
@FadhlanR FadhlanR merged commit 2b3254b into main Mar 14, 2025
51 checks passed
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.

4 participants