Using single or multiple subscriptions within data container

Hi all

I’m hoping some of you smart folk can give me some advice, I’m currently a bit stuck on the best way to do the following.

I’m learning to build a basic app, one part of which lists a number of rooms (think chatrooms) available to the currently logged in user. What I essentially need to do is request a data set from the server and then order the results based on a number of criteria.

The order should always be:

1. Chatrooms that the user has created themselves.
2. Chatrooms that the user is a member of.
3. Chatrooms that the user has requested to join.
4. An additional number of open chatrooms that the user can join (this would be limited to say 10 results and could be managed with a “Load More” style interface to bring down more if needed)

What is the best way to go about doing this? Is this nothing more than using a single container and then sorting the results correctly or should I set up two subscriptions to keep them separate like the following:

  • One pub/sub to manage only the users chatrooms (created / joined / requested rooms)
  • One pub/sub to manage the loading of additional chatrooms

There are some differences in how the chatrooms look and act on the outputted page depending on whether they “belong” to the user or not but I think this can all be handled through conditional rendering once I have the data.

Remembering of course that a user could join any one of these “additional” chatrooms, which would then cause the list to reorder as well. Basically I always need to have the user’s chatrooms available to access as first thing on the page.

Thanks in advance for any help.