yudagn / AetherBnB

AetherBnb is a clone of the website Airbnb that implements many of the features available on Airbnb.
0 stars 0 forks source link

# Sample State: #4

Open Evan-Leon opened 2 years ago

Evan-Leon commented 2 years ago
Evan-Leon commented 2 years ago
yudagn commented 2 years ago

I was planning on not having a jbuilder for reviews, because the only time youll see reviews is on a listing page or the users show page, so i thought it would be best to just make one call to the backend and bring up the users reviews with the user, and the listings reviews with the listing. Should I not do that?

On Wed, Oct 27, 2021 at 10:39 AM Evan Leon @.***> wrote:

  • beware of nesting in entities, reviews should have its own slice of state, and any references to reviews in other entities should be an array of ids

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yudagn/AetherBnB/issues/4#issuecomment-952997276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUE7RR7IAJOOLC4C5SWM2GTUJAFJNANCNFSM5G2Q2H5Q .

Evan-Leon commented 2 years ago

You should definitely do that. Exactly, we should make one call to like the listing show page, that would bring back with it, in the jbuilder response, 3 objects (listings, reviews, bookings?) which we would put as our action payload, and the necessary reducers would handle each slice.

With this we will likely want an array of reviewIds, for reference in our user (if you like, probably not necessary) and listing (probably more necessary), the tea_time demo from the jbuilder lecture has a pretty good example of this workflow