Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 9967143

Browse files
committed
cache features - so when you switch they don't go blank
1 parent 3398fa6 commit 9967143

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

assets/javascripts/discourse/components/ai-usage.gjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,14 @@ export default class AiUsage extends Component {
8585
}
8686

8787
get availableFeatures() {
88-
return (this.data?.features || []).map((f) => ({
89-
id: f.feature_name,
90-
name: f.feature_name,
91-
}));
88+
this._cachedFeatures =
89+
this._cachedFeatures ||
90+
(this.data?.features || []).map((f) => ({
91+
id: f.feature_name,
92+
name: f.feature_name,
93+
}));
94+
95+
return this._cachedFeatures;
9296
}
9397

9498
get availableModels() {

0 commit comments

Comments
 (0)