apc-mhs / mustang-mug

The website, backend, and dashboard for the Mustang Mug Cafe
https://mug.apc-mhs.com
1 stars 0 forks source link

Cart data query optimization #204

Open AndrewLester opened 3 years ago

AndrewLester commented 3 years ago

Reducing the number of queries for the user's cart is an elaborate problem. My idea was to use the fact that a query is made to add items to a user's cart from the menu page. We can respond to this with the user's cart data so that the following redirection to the cart page will already have the necessary cart data, and doesn't have to make another request for the user's cart. If the cart page is being viewed not following a cart item add, then then the cart data must be fetched. Passing data from the cart item add to the cart page can be done using a store.