Search code examples
spartacus-storefront

How to migrate legacy actions in Spartacus SAP


We are trying to move from v3.0 to v 4.0 but we are running into problems with deprecated code. It as has to do with the user service and the user actions. How can we implement v4.0 changes to work with our current code base.

  • resetUpdatePersonalDetailsProcessingState - What can we replace this with as the actions no longer exists
  • We have a few custom stores that listen for those actions. Would we have to re build the whole process so it can carry on working with our current set up?

Solution

  • resetUpdatePersonalDetailsProcessingState - What can we replace this with as the actions no longer exists

    In commands and queries (c&q), there are no processes. Instead, you can just call UserProfileFacade.update() and you'll get the result (or error) in the same stream. No need for process flags. For more about c&q, I recommend you to read this.

    We have a few custom stores that listen for those actions. Would we have to re build the whole process so it can carry on working with our current set up?

    If you need to listen for when the user update is successful (or failed), you can just hook into the command mentioned above, and after it's done you dispatch your custom action to synchronize the state.