fix warning message display on subsequently loaded news

This commit is contained in:
imperosol 2025-02-25 11:53:02 +01:00
parent 94d2c5660a
commit 01c92feb40
2 changed files with 3 additions and 2 deletions

View File

@ -54,7 +54,7 @@ document.addEventListener("alpine:init", () => {
* Query the server to know the number of news dates that would be moderated
* if this one is moderated.
*/
async nbModerated() {
async nbToModerate(): Promise<number> {
// What we want here is the count attribute of the response.
// We don't care about the actual results,
// so we ask for the minimum page size possible.

View File

@ -83,7 +83,8 @@
so it's still reasonable #}
<div
{% if news is integer or news is string %}
x-data="{ nbEvents: nbModerated() }"
x-data="{ nbEvents: 0 }"
x-init="nbEvents = await nbToModerate()"
{% else %}
x-data="{ nbEvents: {{ news.dates.count() }} }"
{% endif %}