-
-
Notifications
You must be signed in to change notification settings - Fork 516
Convert services/accessibility/typescript/models to gjs/gts #2126
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
Open
tcjr
wants to merge
10
commits into
ember-learn:gjs
Choose a base branch
from
tcjr:gjs-misc
base: gjs
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+212
−205
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ab28839
Converted accessibility/page-template-considerations to use gjs
tcjr ebac76d
Converted services to use gjs
tcjr 41b3e0d
Converted typescript invokables to use gts (no diff indicators)
tcjr 8ff7057
Converted typescript gotchas to use gts
tcjr ef8b5f3
Converted typescript testing to use gts
tcjr 73ffab2
Updated diff markers to gts snippets
tcjr 2e88adf
Converted models to use gjs
tcjr 760e43b
Changed import paths
tcjr 41e2655
Merge branch 'gjs' into gjs-misc
tcjr 3341e69
Removed unused reference
tcjr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -90,9 +90,9 @@ writing the admin section of a blogging app, which has a feature that | |||||
lists the drafts for the currently logged in user. | ||||||
|
||||||
You might be tempted to make the component responsible for fetching that | ||||||
data and storing it: | ||||||
data and storing it and showing the list of drafts, like this: | ||||||
|
||||||
```javascript {data-filename=app/components/list-of-drafts.js} | ||||||
```gjs {data-filename=app/components/list-of-drafts.gjs} | ||||||
import Component from "@glimmer/component"; | ||||||
import { tracked } from "@glimmer/tracking"; | ||||||
import fetch from "fetch"; | ||||||
|
@@ -107,30 +107,27 @@ export default class ListOfDraftsComponent extends Component { | |||||
this.drafts = data; | ||||||
}); | ||||||
} | ||||||
<template> | ||||||
<ul> | ||||||
{{#each this.drafts key="id" as |draft|}} | ||||||
<li>{{draft.title}}</li> | ||||||
{{/each}} | ||||||
</ul> | ||||||
</template> | ||||||
} | ||||||
``` | ||||||
|
||||||
You could then show the list of drafts in your component's template like | ||||||
this: | ||||||
|
||||||
```handlebars {data-filename=app/components/list-of-drafts.hbs} | ||||||
<ul> | ||||||
{{#each this.drafts key="id" as |draft|}} | ||||||
<li>{{draft.title}}</li> | ||||||
{{/each}} | ||||||
</ul> | ||||||
``` | ||||||
|
||||||
This works great for the `list-of-drafts` component. However, your app | ||||||
is likely made up of many different components. On another page you | ||||||
may want a component to display the number of drafts. You may be | ||||||
tempted to copy and paste your existing `willRender` code into the new | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
How this persisted 😓 |
||||||
component. | ||||||
|
||||||
```javascript {data-filename=app/components/drafts-button.js} | ||||||
```gjs {data-filename=app/components/drafts-button.gjs} | ||||||
import Component from "@glimmer/component"; | ||||||
import { tracked } from "@glimmer/tracking"; | ||||||
import fetch from "fetch"; | ||||||
import { LinkTo } from '@ember/routing'; | ||||||
|
||||||
export default class DraftsButtonComponent extends Component { | ||||||
@tracked drafts; | ||||||
|
@@ -142,13 +139,13 @@ export default class DraftsButtonComponent extends Component { | |||||
this.drafts = data; | ||||||
}); | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
```handlebars {data-filename=app/components/drafts-button.hbs} | ||||||
<LinkTo @route="drafts"> | ||||||
Drafts ({{this.drafts.length}}) | ||||||
</LinkTo> | ||||||
<template> | ||||||
<LinkTo @route="drafts"> | ||||||
Drafts ({{this.drafts.length}}) | ||||||
</LinkTo> | ||||||
</template> | ||||||
} | ||||||
``` | ||||||
|
||||||
Unfortunately, the app will now make two separate requests for the | ||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.