Skip to main content
← Data, API & Backend
Data, API & Backend May 20, 2022 · 9 replies

Like button state (solved)

Archived from the Bravo community forum (2021–2026). Some answers may refer to older versions of Bravo.

Hi I was going thru like button example provided by Bravo as well as the approach from post :

How to add "like" functionality to your Bravo app using Xano as back end

But I still can't have it done. In Bravo Sample: Like Button example, like have two states default and active controled by likedstate variable. I've created similar variable in my Xano request but as a variable it works globally for all likes and I don't know how to change that 

image.png

image.png

Another problem is that remote actions are not successful, they are working via api collection, but not in app itself

9 replies

app.monster May 22, 2022

Hi Pawel,

your issue sounds like you didn't implement the user filter correctly. That could be a reason for the like behaving "globally". I don't see any user connection in the screenshots you've sent...

Pawel May 22, 2022

image.png

I have an addon in content record which determines if this content was already liked ( voted in my case) by current user. I have also the custom variable vote_state which switch the variant of vote icon from default to active based on the _voted addon status. The problem is that variable is outside the list of record and works globally on every member based on last iteration of loop (at least i think that is the case)

Pawel May 22, 2022

Yeah, not exactly because it is not working correctly... But I'm not sure how to do it correctly so vote icon in every instance of content is changing independently based on _voted status.

Leonor May 23, 2022

Hello Pawel!

Did you try to include "user_id" as an input, and an "If" statement to distinguish between the users that have voted –and not voted– for each item?

Like button.png

Pawel May 23, 2022

Hi Leonor!
Thanks for reply.

Distinguishing is not a problem, I have an addon which determines if the auth user already voted or not. The problem is that I have a variable which is controlling the state of vote icon (active/default) and I don't know how to make this variable independent for every instance of the list. 

image.png

state variable is outside the content, getting the value from the last iteration of the loop and affecting the list as a whole.

Pawel May 25, 2022

Issue is solved. My mistake was that I was not aware at the time how I can create for an instance. For me it was cont.vote_state (where cont is the instance of list content)

Rajiv June 7, 2022

thanks for this. I am assuming we can use this for a scenario where a user wants to "favorite" and save to their saved lists? Thanks

Wrote something in this thread and want it removed? Request removal

Still stuck?

Ask the community on Discord

This archive is read-only. New questions, office hours and product updates now happen in the Bravo Discord.

Join the Discord