Open History to see the last commit
1<div>
2 <h1>Posts</h1>
3 @if (postsQuery.isPending()) {
4 Loading...
5 } @else if (postsQuery.isError()) {
6 Error: {{ postsQuery.error().message }}
7 } @else if (postsQuery.isSuccess()) {
8 <div class="todo-container">
9 @for (post of postsQuery.data(); track post.id) {
10 <p>
11 <!-- We can access the query data here to show bold links for -->
12 <!-- ones that are cached -->
13 <a
14 href="#"
15 (click)="setPostId.emit(post.id)"
16 [style]="
17 queryClient.getQueryData(postsQueries.detail(post.id).queryKey)
18 ? {
19 fontWeight: 'bold',
20 color: 'green',
21 }
22 : {}
23 "
24 >{{ post.title }}</a
25 >
26 </p>
27 }
28 </div>
29 }
30 <div>
31 @if (postsQuery.isFetching()) {
32 Background Updating...
33 }
34 </div>
35</div>