How to display related questions and answers in a social app

Hi everyone!

I’m new to WeWeb and I wanted to ask a general question about how to display questions and answers when building a social-style app. I’m not sure of the best practice in WeWeb for this, so I thought I’d reach out to the community.

Here’s what I’m trying to do:

I’m building something like Reddit, where users can post questions and others can reply. In Supabase, I’ve created two tables: questions and answers.

What I’d like to do is show a feed of questions, each with its related answers below. But I’m struggling with how to set this up. For example, if I use a collection with just the questions table, I can only show the questions, not the related answers.

Should I maybe do a join in Supabase between the two tables, and then create a collection in WeWeb based on that joined view? Or is there a better way to do this in WeWeb?

Thanks in advance for any suggestions or help! I’m really enjoying working with WeWeb so far!

you could load in the answers using a select on click of the question, or you could have a collection filtered by the question that you fetch. of if you want the answers always showing you could use advanced mode on you questions collection and load in the questions. There’s heaps of options which can be tricky it really depends on the specifics of your situation.

1 Like

Hi Sam, thank you for your reply! So, if I want to display questions and answers like it’s done here in the community, is it preferred to load the questions and use advanced mode to load the answers?

Not quite, if were copying this forum I would go with 2 collections questions and then a current questions Answers collection this would be filtered by the selected question in the call. the issue with using advanced in this case is that you could potentially have 100 answers to one question and you only need that data if the user clicks on the question. but if each question has a max of 3 answers like a quiz or something bringing them all in wouldn’t be an issue

1 Like