mail icon indicating copy to clipboard operation
mail copied to clipboard

Migrate the main mail store to Pinia

Open GVodyanov opened this issue 1 year ago • 3 comments

Fix https://github.com/nextcloud/mail/issues/9237

This is going to be a big one...

Splitting stores into multiple files isn't very common in Pinia, but I really wanted to do so in this case, I took my inspiration for how to do it from these guys https://github.com/vuejs/pinia/issues/802

A little overview of how this was done:

  • Created a subfolder in /store for all the main mail store stuff
  • Migrate all the getters and remove now useless ones (the ones that just point to a piece of state without modifying it)
  • Migrate the actions file
  • Rename all the mutations to [previous name] + Mutation
  • Migrate dispatch and commit usages in components to the correct Pinia usage
  • Move the renamed mutations into the actions file, hence making them actions (and this time I didn't inline anything, at least yet)
  • Realized that a lot of the getters had parameters, which you can't have in Pinia, so those become actions as well (not renamed)
  • Lots of bugfixing
  • Migrate the tests (the component ones are easy, just updating references, however the ones that actually test the store itself require pretty significant modification)

GVodyanov avatar Sep 12 '24 15:09 GVodyanov

Not opening the PR yet as I still have the tests to migrate, but mail is useable (as far as it seems)

GVodyanov avatar Sep 30 '24 15:09 GVodyanov

Thanks so much for finishing the hardest parts Richard <3

GVodyanov avatar Oct 10 '24 14:10 GVodyanov

needs a rebase, I wish you luck 🍀

hamza221 avatar Oct 10 '24 14:10 hamza221

Let's get this in

ChristophWurst avatar Nov 20 '24 07:11 ChristophWurst

Waiting for https://github.com/nextcloud/mail/pull/10453

EDIT: Merged

st3iny avatar Jan 07 '25 15:01 st3iny

Oh shoot I'm sorry I didn't see that you wanted to finish this too @st3iny. I hope I didn't step on your feet here, everything should work now though, if you could just give a final review.

GVodyanov avatar Jan 11 '25 18:01 GVodyanov

No no, all good. I didn't do anything yet, just assigned myself to not forget about the PR.

Thanks for the final rebase :)

st3iny avatar Jan 11 '25 22:01 st3iny