Closed OrchardSkills closed 4 years ago
Yes, this issue has been seen before (we even saw it during a demo once, and then neither Seb nor I could repro it the next day)
Here's what I know
GetMediaItems()
and GetFolders()
(js calls) return successfully, with what appears to be the correct data, i.e. [] an empty array. (I think)here's what fixes it
create a folder in the library
then delete the folder
it still works.
If you are currently able to repro it @OrchardSkills what would be useful is to confirm the two js calls mentioned above in the chrome dev tools (screen shots be helpful), with both their return values, and the order in which they are returned.
What I personally think is there is an event being called in the vue app with either bad data, or out of the correct order, which can occur sometimes on fresh installs.
If you wanted to try and debug it down @OrchardSkills I would start in the js app.
btw, just tried now, can't repro again, but I've seen it, so I know it's a real thing.
I can reproduce it every time with the Blog recipe.
Check out this video on Orchard Skills: https://youtu.be/7F00sYlhtno
Yes, Dean. I can debug through it and see whats going on.
This only occurs when the complete browser history is cleared or running Orchard Core in a browser the first time.
There is an issue with the media library. media.js self.loadFolder(folder) is never called until add or move a folder event occurs. On a browser, that hasn't run Orchard Core or the history and cache have been cleared, The function self.loadFolder(folder) should be called at the initialization.
May aso want to call self.loadFolder(folder) during the folderSelected event:
bus.$on('folderSelected', function (folder) {
self.loadFolder(folder);
self.selectedFolder = folder;
});
That way if a folder is selected it will load and display the list.
Okay i can repro under a new browser or under Chrome if i remove the mediaApplicationPrefs
item from the local storage.
You don't need to add loadFolder()
as it is done when you update the selectedFolder
property that is watched, but it needs to be set with a new object. I will do a PR to fix it when i will have time as i need to run the gulp pipeline.
awesome @OrchardSkills you found the repro for it!
That's been occasionally bugging me for a year and a half now :)
I fixed it this night, in app.js
we need to add line 120
if (!localStorage.getItem('mediaApplicationPrefs')) {
self.selectedFolder = _root
return;
}
self.currentPrefs = JSON.parse(localStorage.getItem('mediaApplicationPrefs'));
But i had problem with npm install
, i spent a part of the night to understand why it was executing in an infinite loop the install scripts of the root package.json
, i needed to replace cd src/OrchardCore.Themes/TheAgencyTheme
with cd src/OrchardCore.Themes/TheAgencyTheme/wwwroot
to make it working. This because in TheAgencyTheme
there is a root package.lock.json
but no package.json
, only under wwwroot
.
@agriffard do we need both? OR which one?
But then gulp build was failing, otherwise for testing by changing the script directly under wwwroot, it was working
So i think that currently with the last dev there is a problem with npm install and gulp cmds
I'm going to sleep, will see tomorrow ;)
I added package.json into TheAgencyTheme.
@jtkech Thanks for the fix!
Media Library not being initialized correctly when browser history is totally cleaned or Orchard Core is run for the first time in a browser. An example is selecting the blog theme. Edit the blog post. Delete the image. Try to load the image back. No images are found. There should be a list of images loaded through the recipe. Add a new image. The image shows up. Select it. Delete it again. Publish the blog post. Go back to edit it again. Try again to add an image. No images are found. Workaround: Create a directory. Now all the images show up on the list.