Force Data View to update after serverconnect query reloaded

I have a SPA app. On one page I update data and then onsuccess refresh/reload the serverconnect query. On another page this serverconnect query has a data view to make sorting and filtering easier/quicker on the page.

I can see the query refreshing in dev tools but the data view stays unchanged. Can one force refresh the data view?

1 Like

I see what you mean, a Dataview.refresh() dynamic action would be useful. Would re-forcing the sort via dynamic actions cause a refresh?

I removed dataview for now, to test if I can just get the page to show update, but despite updating the query, the page with or without dataview is not updated if the page is not currently displaying.

I will have to try and find a workaround by adding query refresh to the nav button to navigate to it.

Only problem is when user pressed back it will not refresh.

To be clear - query shows updated in dev tools, but the view isn’t updated

Trying to “Fool” app connect by adding a server action that inserts a field in db and the onsuccess refresh the qeury but also not working. I guess server connect is clever enough to check if any changes in a query before refreshing it and this work around is not fooling it

Also tried setting localstorage to 1 second and see if the query will refresh after running itself on success in fact creating a loop that just keeps on refreshing in the background.

I guess this is the worst I can do for my server if we are going to have hundreds of people at the same time and this one query - around 1kb is going to keep on refreshing till they leave the web site…

This obviously works, but the payoff is maybe a server crashing :open_mouth:

Hello Marcel,
Despite the several posts it’s not clear to me what are you doing on your pages. Is it this:

Main page:

  • server connect which updates data
  • server connect which lists the data

SPA content page:

  • data view created by the server connect which lists the data

?

Or are these in two different content pages?

2 different content pages with the server connect files on the individual pages. Nothing in this case is on the Main page.

But are the two server connects on a same page? Or are they like:

Content page 1:

  • server connect which updates data

Content page 2:

  • server connect which lists the data
  • data view created by the server connect which lists the data

Like you have it, I do however refresh the query after update on content page 1 and can see in dev tools how the query is updated with changed data.

When browsing to the “view” on content page 2, nothing is updated on the page.

Page 2 has a repeat that shows the records

What is that query? How do you refresh a query? Aren’t you running server connect which lists the data, on success update? Is it possible for you to explain where do you have what on your pages, as the terms you are using are not making it clear.

Sending you link and info in private message to see for yourself

In today’s update we are going to introduce Show and Hide dynamic and static events for the page routes. They can be used to load server actions or custom js script, when a route is shown or hidden, so you will be able to reload your server action on every route load.

4 Likes