mirror of
https://github.com/discourse/discourse.git
synced 2025-03-26 18:35:49 +08:00
DEV: Clarify site-setting category-list concurrency protection (#25614)
This commit is contained in:
parent
2af8f5708d
commit
250ce25ca3
@ -21,14 +21,22 @@ export default class CategoryList extends Component {
|
|||||||
return this.args.value.split("|").filter(Boolean);
|
return this.args.value.split("|").filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateSelectedCategories() {
|
async updateSelectedCategories(previousRequest) {
|
||||||
await this.pendingCategoriesRequest;
|
const categories = await Category.asyncFindByIds(this.categoryIds);
|
||||||
this.selectedCategories = await Category.asyncFindByIds(this.categoryIds);
|
|
||||||
|
// This is to prevent a race. We want to ensure that the update to
|
||||||
|
// selectedCategories for this request happens after the update for the
|
||||||
|
// previous request.
|
||||||
|
await previousRequest;
|
||||||
|
|
||||||
|
this.selectedCategories = categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
valueChanged() {
|
valueChanged() {
|
||||||
this.pendingCategoriesRequest = this.updateSelectedCategories();
|
const previousRequest = this.pendingCategoriesRequest;
|
||||||
|
this.pendingCategoriesRequest =
|
||||||
|
this.updateSelectedCategories(previousRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
Loading…
x
Reference in New Issue
Block a user