nnich19
5
Just spitballin’ here, but you may be performing unnecessary searches since you’re doing the search for Likes’s ID on every item in the RG group.
Instead, I’d maybe do a search for a user’s likes ONCE, then check against that.
Option 1: Set state on page load (or whatever)
- State = Search for Likes (created by current user, plus any other search terms that make sense and/or increase efficiency)'s ID
- Conditional statement = Only when: User is logged in and State contains parent group’s thing’s ID.
Option 2: Variable RepeatingGroup (I like this so I don’t have to keep resetting a state)
- Create a repeatinggroup specifically for holding the user’s likes, give it the same data source as the State in option 1. I usually put these in their own popup so they don’t clutter up the “usable” elements on the page.
- Conditional statement = Only when: User is logged in and repeatinggroup x’s things contains parent group’s thing’s ID
This way, you’re checking each item against the user’s entire list of likes, but you’re not pulling the user’s list of likes for each item in the repeatinggroup. This may not improve your speed immediately, but it may scale a bit better if you end up with lots of users with lots of likes.
Edit: yeah, I know. This is essentially a moot point when you have single digit items in the database, so yeah… That part sucks.