@rebilly/revel 13.8.1 → 13.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,7 @@ interface Cache {
|
|
|
15
15
|
lastKey: Nullable<string>;
|
|
16
16
|
}
|
|
17
17
|
export interface Component extends CreateComponentPublicInstance {
|
|
18
|
+
search?: string;
|
|
18
19
|
async: {
|
|
19
20
|
cache: Cache;
|
|
20
21
|
query: Query;
|
|
@@ -67,6 +68,7 @@ export declare class AsyncExtension {
|
|
|
67
68
|
/** Returns true if last request has any options. */
|
|
68
69
|
hasOptions(): boolean;
|
|
69
70
|
find(value: Value, params?: Partial<Query>): Promise<void>;
|
|
71
|
+
private matchesCurrentSearch;
|
|
70
72
|
private baseFindBySearch;
|
|
71
73
|
findNext(): Promise<void>;
|
|
72
74
|
findPrev(): Promise<void>;
|
|
@@ -101,24 +101,29 @@ var r = class r {
|
|
|
101
101
|
f(), this.handleLoaded();
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
let n = this.getFromCache(d),
|
|
105
|
-
if (s &&
|
|
104
|
+
let n = this.getFromCache(d), o = r.validateCacheData(n, { expiration: s });
|
|
105
|
+
if (s && o) {
|
|
106
106
|
f(), this.handleLoaded();
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
let
|
|
109
|
+
let c = await this.asyncFind(t, u);
|
|
110
|
+
if (this.cache.lastRequestId !== i || !this.matchesCurrentSearch(t)) return;
|
|
110
111
|
delete this.component.async.cache.itemsByKey[d], f(), this.saveToCache({
|
|
111
112
|
key: d,
|
|
112
|
-
options:
|
|
113
|
+
options: c,
|
|
113
114
|
value: t,
|
|
114
115
|
query: e(u)
|
|
115
116
|
}), this.handleLoaded();
|
|
116
117
|
} catch (e) {
|
|
117
118
|
console.error(e);
|
|
118
119
|
} finally {
|
|
119
|
-
this.component.async.isLoading = !1;
|
|
120
|
+
this.cache.lastRequestId === i && this.matchesCurrentSearch(t) && (this.component.async.isLoading = !1);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
123
|
+
matchesCurrentSearch(e) {
|
|
124
|
+
let t = this.component.search;
|
|
125
|
+
return typeof t != "string" || this.prepareCacheValuePrefix(e) === this.prepareCacheValuePrefix(t);
|
|
126
|
+
}
|
|
122
127
|
baseFindBySearch(e) {
|
|
123
128
|
return this.find(e, { offset: 0 });
|
|
124
129
|
}
|