File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 24
24
</div >
25
25
{{ /if }}
26
26
27
- {{ #if @crate .keywords}}
27
+ {{ #if this .keywords}}
28
28
<ul local-class =" keywords" >
29
- {{ #each @crate .keywords as |keyword |}}
29
+ {{ #each this .keywords as |keyword |}}
30
30
<li >
31
31
<LinkTo @route =" keyword" @model ={{ keyword.id }} data-test-keyword ={{ keyword.id }} >
32
32
<span local-class =" hash" >#</span >{{ keyword.id }}
Original file line number Diff line number Diff line change 1
1
import { inject as service } from '@ember/service' ;
2
2
import Component from '@glimmer/component' ;
3
3
4
+ import { task } from 'ember-concurrency' ;
5
+ import { alias } from 'macro-decorators' ;
6
+
4
7
export default class CrateHeader extends Component {
5
8
@service session ;
6
9
10
+ @alias ( 'loadKeywordsTask.last.value' ) keywords ;
11
+
12
+ constructor ( ) {
13
+ super ( ...arguments ) ;
14
+
15
+ this . loadKeywordsTask . perform ( ) . catch ( ( ) => {
16
+ // ignore all errors and just don't display keywords if the request fails
17
+ } ) ;
18
+ }
19
+
7
20
get isOwner ( ) {
8
21
return this . args . crate . owner_user . findBy ( 'id' , this . session . currentUser ?. id ) ;
9
22
}
23
+
24
+ loadKeywordsTask = task ( async ( ) => {
25
+ return ( await this . args . crate ?. keywords ) ?? [ ] ;
26
+ } ) ;
10
27
}
You can’t perform that action at this time.
0 commit comments