count() works in Preview but not in Live

Hi,

As per subject. This is the code:

export function table1_dataChange(event) {
 let count = $w("#dataset1").getTotalCount(); 
        console.log(count)
        $w("#counter").text = String(count);
}

In Console, I get the ‘count’ properly. It’s 547. In Live, it just shows 000.

This was working just fine as of a few days ago. No intervention by me for a long time in that page/code.

Any ideas please?

edit: for your convenience, this was a problem I’ve had back in nov. or dec. 2020, and I was advised to post in a “rolling-out improvements” thread and sb solved it right away.

Did you sync your sandbox data with the Live?

Always the same little issues :grin: (Sync + Permissions)

Hi @yisrael-wix and @russian-dima , I believe I’m quite… elderly now, velo/code-wise, to make this specific kind of mistakes. So yes, data are synced and permissions are the same 4 months now, no change whatsoever. As I said, it was working and then sometime I realized that it stopped without me messing with it, for many weeks.

Don’t talk to me about “elderly” - I probably have underwear older than you.

And the sync/permissions issue may be obvious, but it’s the most common mistake. Even experienced developers sometimes forget or just overlook it.

Please post the URL of your site and explain what I need to do see the problem.

[underware mode on]

www.civilitas.gr/immigration-law. Just check the counter at the bottom of the page. It’s 000 on initial load, only. If you click on any radio button and choose any random filter, the counter will read the items found properly. Then, if you press Reset, the total number will be again be read properly. Problem is with the initial loading of the page. In Preview, the initial loading shows the number ok.

[underware mode off]

First, I believe that you are correct and that the issue is connected to the performance release. I see that when I bypass the new release, the correct count displays. However…

I suggest that you try enabling the “Fetch after the page loads” option:

That might cause the dataset and the page to get things done in the correct order. Give it a try and let me know as soon as you can if it helps.

Seems to me that the issue is in fact a bug, but I’d like to see what affect the load option has so I can give QA as much information as possible regarding the problem.

@yisrael-wix Checking the “Fetch after the page loads” does the trick, indeed. Tried it and it works.

1 Like