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

Can create new instance in playground #2162

Merged
merged 8 commits into from
Feb 24, 2025

Conversation

burieberry
Copy link
Contributor

@burieberry burieberry commented Feb 18, 2025

Copy link

github-actions bot commented Feb 18, 2025

Host Test Results

    1 files  ±0      1 suites  ±0   23m 57s ⏱️ +50s
774 tests +1  772 ✔️ +1  2 💤 ±0  0 ±0 
779 runs  +1  777 ✔️ +1  2 💤 ±0  0 ±0 

Results for commit e4f0d12. ± Comparison against base commit febc865.

♻️ This comment has been updated with latest results.

@burieberry burieberry force-pushed the cs-7910-create-instance-in-playground branch from eab8536 to afbfc16 Compare February 20, 2025 20:42
@burieberry burieberry marked this pull request as ready for review February 20, 2025 21:46
@burieberry burieberry requested a review from a team February 20, 2025 21:49
},
};
try {
let card = await this.cardService.createFromSerialized(doc.data, doc);
Copy link
Contributor

Choose a reason for hiding this comment

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

please use CardResource to create new cards, not the CardService directly. failing to do so will result in an instance that doesn't consistently rerender for live updates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, will do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this to use card-resource. Had some trouble persisting the new card and adding it to recent-cards, so you'll see the note I made in createNew task.

Copy link
Contributor

@habdelra habdelra left a comment

Choose a reason for hiding this comment

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

New instances should always be created via CardResource. Here is an example of what that looks like https://github.com/cardstack/boxel/blob/main/packages/host/app/lib/stack-item.ts#L55-L58

@burieberry burieberry requested a review from habdelra February 21, 2025 19:51
Copy link
Contributor

@habdelra habdelra left a comment

Choose a reason for hiding this comment

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

Looks good!

@burieberry burieberry merged commit b704048 into main Feb 24, 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.

2 participants