Savelist Architecture
Savelist Arhitecture can be broken down into two broad levels of CRUD operations. At the first level we have:
Savelist Arhitecture can be broken down into two broad levels of CRUD operations. At the first level we have:
- Savelist CRUD: As the name suggests, this is the parent level at which we can do CRUD operations on Savelists.
- Product CRUD: At this level, we can perform CRUD operations on the product(s) in a savelist.

Savelist Health
Interestingly enough, we have a savelist health endpoint which ensures that the backend services related to savelists are working or not. It's a health endpoint that we hit only once when we open TsSavelist.vue; which is essentially the savelists page, under the my account section.
You can read more about the method: savelistStore.verifysavelisthealth()
Savelist CRUD
Since it is a CRUD, the four basic methods that we ought to have for Savelist are to create, read, update and delete a savelist. Let's have a look at these four methods.
Create Savelist
Creating savelist(s) is handled by the method called createNewList.
We cannot create bulk savelists. We can only create one savelist at any given time.
Key takeaway aways from this method are:
- In the method we update the
current_active_savelistas soon as we have created the savelist. This state maintains what tab is currently selected in the UI. If we updatecurrent_active_savelist.index; where index is the number of the "tab", starting from0, it means that we will update the currently selected tab in the UI as well. The first tab will have the index of0, and so on. Maximum acceptable value ofcurrent_active_savelist.indexis=user_savelists.length()and it can never be greater than that (obviously). - In the very next line, we also refetch User Savelists so as to show the updated savelists to the user. This fetching happens in the background though - and only a small preloader is shown to the user - updated savelists are fetched and shown to the user. For this, we call the method
getUserSavelists
Read more about the method: savelistStore.createNewList