GM I am building in Upvote type of features. I see that active states are still in work for buttons.
I currently have 2 buttons that have workflows to POST and DELETE from an upvote table in Xano. The two buttons are conditionally displayed if a user has upvoted that collection item or not. I have the following function to display the button.
length(filterByKey(filterByKey(collections[‘f1f3fb1c-ff3c-46b5-baa3-d33614ded19a’][‘data’][‘all_upvotes’],“Block”,context.item.data[‘id’]),“User”,12)) < 1
I use a nested filterbykey on the entire upvote table to identify if the logged in user (currently testing user ‘12’ while I set up xano auth still) has upvoted that collection item.
When I click on the buttons in weweb preview, the post and delete api requests work. The conditional display does NOT update immediately however. Not until when I exit out of preview and re-enter preview or refresh the page, do the displays of those buttons update.
I don’t think the conditional display logic is too heavy for weweb front end. I also doubt this is a ‘preview mode bug’. I suspect it is because the collection data is stale until it’s refreshed. How do I make the collection data update on every workflow API call?
If it’s not possible to update the collection data in real time, I figure a more elegant solution would be to have the display and POST/Delete action binded to the active/unactive state of the button. But it looks like that’s still in the works it sounds like. I don’t see a tutorial for how it was specifically done in the public roadmap.
Any help is appreciated, thank you