skydread1/flybot.sg

re-frame db post orders are not updated after post creation

skydread1 opened this issue · 0 comments

Problem

As for now, when a post creation request is made, the server updates the backend db with the new post and it also updates the posts with the new :post/default-order value.

However, the server only returns the posts that has been added only.

This new post is then added to the re-frame db via the re-frame response fx. However, the other posts do not have the up-to-date ``:post/default-order` value because it was not part of the server response.

Suggestion

I can think of 2 approaches:

  1. Move update-post-orders-with to a .cljc file to be able to access it from the frontend as well.

This solutions prevents us from having to make another request to the server to get the posts with the new orders. It then also prevents to have additional re-frame events.

  1. Add another backend route that given the new post and the action type return the new orders (without any effects since they are already done in the new-post route)

This method allows us to pull everything at once. It does make us add an additional route to the backend however.