[4.0] Fix various instances where we were doing bad things in vuex#24751
[4.0] Fix various instances where we were doing bad things in vuex#24751wilsonge merged 2 commits intojoomla:4.0-devfrom
Conversation
There was a problem hiding this comment.
code lgtm.
only some notes/questions:
-
Why is this needed?
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) -
Imo we dont need 2 way binding for the renaming. It might seem nice in the first place, but iirc the inline change is hidden behind a modal backdrop, so we can simplify things with 1 way databinding aka:
<input id="name" class="form-control" placeholder="Name"
:value="name" @input="rename"
required autocomplete="off">
// change computed property name to only get the name from store
// Add rename method, which will commit the change
-
personal opinion: i do not like words like "do", "run", "execute", "perform" or "process" xxx in method or var names, so i would rename "perform_rename" to "rename" or "change_name"
-
FYI: we had discussions about removing vuex from mm to avoid the additional complexity it brings to the table. What’s your opinion on that?
I took it from the docs on the environment plugin here. It gave it's equivalent using the define plugin https://webpack.js.org/plugins/environment-plugin/ (and it seemed to work for me). I always have to google this one every time...
We can but then rather than do anything on change. We should just wait for the user to hit save. And use the existing save function. And remove the whole responsiveness other than for giving feedback on validity.
I have no preference on naming conventions. Done
I don't think you'll save yourself much complexity because for things like showing the modals we'll have to pass deep nested functions through the application (also for example dealing with selected items interaction with the toggle all). And that will become a maintenance issue as well (especially as it's "bad practice" for any of these js apps). |
d44e642 to
3056794
Compare
ad094bb to
05ac62a
Compare
|
OK Second commit removes everything and just does the update in the existing |
This is harder to test but is cleaning up some tech debt in the code base. In some places we were directly manipulating the vuex state, which as documented in the code shouldn't be done. I've cleaned that up to correctly use a mutator. To test ensure that the rename modal works before and after the patch in media manager
In addition if you now build media manager in dev mode (or watch which is dev mode by default) we now enable vuex strict mode (note as per the docs you shouldn't use strict mode in production https://vuex.vuejs.org/guide/strict.html). This means in the future when people do dev work they should get warnings when they do such bad things.
@dneukirchen are you able to do a code review here please