User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Also, and this one is important and the reason I did this PR, stop mutation store values outside of the store. The vue docs are very clear on this one: https://eslint.vuejs.org/rules/no-side-effects-in-computed-properties.html#rule-details
The instance that was wrongly mutating the store is:
/* Get the contents of the currently selected directory */
items() {
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
const directories = this.$store.getters.getSelectedDirectoryDirectories
// Sort by type and alphabetically
.sort((a, b) => ((a.name.toUpperCase() < b.name.toUpperCase()) ? -1 : 1))
.filter((dir) => dir.name.toLowerCase().includes(this.$store.state.search.toLowerCase()));
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
const files = this.$store.getters.getSelectedDirectoryFiles
// Sort by type and alphabetically
.sort((a, b) => ((a.name.toUpperCase() < b.name.toUpperCase()) ? -1 : 1))
.filter((file) => file.name.toLowerCase().includes(this.$store.state.search.toLowerCase()));
return [...directories, ...files];
},
And is replaced with
/* Get the contents of the currently selected directory */
localItems() {
const directories = this.$store.getters.getSelectedDirectoryDirectories.slice(0)
// Sort by type and alphabetically
.sort((a, b) => ((a.name.toUpperCase() < b.name.toUpperCase()) ? -1 : 1))
.filter((dir) => dir.name.toLowerCase().includes(this.$store.state.search.toLowerCase()));
const files = this.$store.getters.getSelectedDirectoryFiles.slice(0)
// Sort by type and alphabetically
.sort((a, b) => ((a.name.toUpperCase() < b.name.toUpperCase()) ? -1 : 1))
.filter((file) => file.name.toLowerCase().includes(this.$store.state.search.toLowerCase()));
return [...directories, ...files];
},
The rename from items
to localItems
was on purpose to emphasise that this is a local representation of the data!!!
Apply the PR, run npm ci
and check that the media manager is still working
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Category | ⇒ | JavaScript Administration com_media NPM Change |
Status | New | ⇒ | Pending |
Category | JavaScript Administration com_media NPM Change | ⇒ | JavaScript Administration com_media NPM Change Repository |
Labels |
Added:
NPM Resource Changed
PR-4.3-dev
|
Title |
|
@dgrammatiko I can merge it for you but it's on the 4.2 branch. You will have to wait for the up-merge to get this fixed in 4.3
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-01-27 07:51:51 |
Closed_By | ⇒ | laoneo | |
Labels |
Added:
?
|
Thanks!!
See text briefly displayed upon loading Media Manager.