Hi Everyone,
I’m building an inventory of products similar to producthunt.com. People can upvote for products. my question is related to updating data on the front end.
Current state:
Right now, you can vote for a product but you need to reload the page in order to see that your vote is taken into account : made.eco - Discover the next eco revolution. You need to sign in in order to test.
You can see the number of votes insite the button.
Goal state:
After I send the incremental vote to Supabase (let’s call it Workflow A), I would like to update the value (“14” in this example) contained inside the button, so the user can see that his vote is taken into account
Question:
Is it possible to reload the updated value after the workflow A is completed ? If not, is it possible to reload the entire front end component ?
Additional information
Database : Superbase
Product page : collection page built with static data (static collection) except the vote counter: I use a lookup formula in order to get the live value from a dynamic collection.
Let me know if it’s not clear enough.
Thank you very much for your help
Fabien
You could add a Fetch collection action at the end of your workflow that fetched the updated dynamic collection. That should do the trick. But maybe there would be a more optimal way to build that instead of fetching the whole collection?
Hi @jptrinh,
It does work indeed! Thanks for your help!
I have the same concern as you about fetching the entire collection. I’ll make a bootstraped one in order to load less data but it doesn’t feel like it’s the most optimal way still.
Allowing you to patch a collection dynamically is in the roadmap! It would help in this scenario so you don’t have to fetch the collection to update only one property in one item.
In the meantime a more efficient way to achieve it would be to fake it! Create a little variable that will remember every vote made during the session, you just have to push the item id in an array for exemple. Then in your formula where you bound the vote value, you can use a formula to add 1 if the item id is present in the variable, and voilà!
Planned in the short term roadmap, we will release new realtime features for Xano and Supabase, and then we will work on a new patch collection action as they will most probably be used together