17
17
import { consume } from '@lit/context' ;
18
18
import { Task , TaskStatus } from '@lit/task' ;
19
19
import { LitElement , type TemplateResult , html } from 'lit' ;
20
- import { customElement , state } from 'lit/decorators.js' ;
20
+ import { customElement , state , property } from 'lit/decorators.js' ;
21
21
import { type components } from 'webstatus.dev-backend' ;
22
22
23
23
import {
@@ -55,9 +55,12 @@ export class OverviewPage extends LitElement {
55
55
data : null ,
56
56
} ;
57
57
58
- @state ( )
58
+ @property ( { type : Object } )
59
59
location ! : { search : string } ; // Set by router.
60
60
61
+ @state ( )
62
+ currentLocation ?: { search : string } ;
63
+
61
64
constructor ( ) {
62
65
super ( ) ;
63
66
@@ -67,7 +70,17 @@ export class OverviewPage extends LitElement {
67
70
task : async ( [ apiClient , routerLocation ] ) : Promise <
68
71
components [ 'schemas' ] [ 'FeaturePage' ]
69
72
> => {
70
- return this . _fetchFeatures ( apiClient , routerLocation ) ;
73
+ if ( this . location . search !== this . currentLocation ?. search ) {
74
+ // Reset taskTracker here due to a Task data cache issue.
75
+ this . taskTracker = {
76
+ status : TaskStatus . INITIAL ,
77
+ error : null ,
78
+ data : null ,
79
+ } ;
80
+ this . currentLocation = this . location ;
81
+ return this . _fetchFeatures ( apiClient , routerLocation ) ;
82
+ }
83
+ return this . taskTracker . data ?? { metadata : { total : 0 } , data : [ ] } ;
71
84
} ,
72
85
onComplete : page => {
73
86
this . taskTracker = {
0 commit comments