givanz / Vvveb

Powerful and easy to use cms to build websites, blogs or ecommerce stores.
https://www.vvveb.com
GNU Affero General Public License v3.0
384 stars 82 forks source link

Media Library page suddenly blank ? #146

Closed Twilight-Computer closed 1 month ago

Twilight-Computer commented 4 months ago

After editing products, I tried to set featured media - no response.

So I went directly to the Media Library - no images show only "Upload new image" button.

Enabled Debug, but nothing of any importance shown in Errorlog or SQL calls ?

Thoughts / ideas on how to resolve (note: same issue on my test site (same code / different backend mySQL database). image

givanz commented 4 months ago

This looks like it might be caused by javascript cache.

If it still doesn't work after browser clear cache please check for javascript errros in developer tools > console (F12 key).

You can also check the network tab for the result of index.php?module=media/media&action=scan request and see if it shows valid json like in the bellow screenshot.

Please paste here any error you find in developer tools.

media-json

Twilight-Computer commented 4 months ago

I have downloaded lastest.zip and applied to my test environment - same problem. (Note I did not import any of my own media). Developer tools show these errors:

Uncaught SyntaxError: invalid assignment left-hand side media.js:586:6 Uncaught TypeError: MediaModal is not a constructor

https://test.twilightcomputer.com.au/admin/default/libs/vvveb/index.js:28 [index.js:28:22](https://test.twilightcomputer.com.au/admin/default/libs/vvveb/index.js) This alert appears in the network tab for the index.php?module=media/media&action=scan: ​Partitioned cookie or storage access was provided to “https://test.twilightcomputer.com.au/vadmin-live/index.php?module=media/media&action=scan” because it is loaded in the third-party context and dynamic state partitioning is enabled ​
givanz commented 4 months ago

It looks like media.js is not updated on https://www.twilightcomputer.com.au/admin/default/libs/media/media.js where line 586 has an assignment.

The test version https://test.twilightcomputer.com.au/admin/default/libs/media/media.js is the same as the latest version https://github.com/givanz/vvveb-admin-template/blob/master/libs/media/media.js#L586 and does not have an assignment on line 586.

Twilight-Computer commented 4 months ago

The error is showing up in both live and test. I copied media.js from the test environment to live, but there is no noticeable change ? Errors from test now show: Uncaught SyntaxError: invalid assignment left-hand side media.js:586:6 Uncaught TypeError: MediaModal is not a constructor

https://test.twilightcomputer.com.au/admin/default/libs/vvveb/index.js:28 [index.js:28:22](https://test.twilightcomputer.com.au/admin/default/libs/vvveb/index.js) Source map error: JSON.parse: unexpected character at line 1 column 1 of the JSON data Resource URL: https://test.twilightcomputer.com.au/admin/default/js/popper.min.js Source Map URL: popper.min.js.map Source map error: JSON.parse: unexpected character at line 1 column 1 of the JSON data Resource URL: https://test.twilightcomputer.com.au/admin/default/js/bootstrap.min.js Source Map URL: bootstrap.min.js.map ​
givanz commented 4 months ago

https://www.twilightcomputer.com.au/admin/default/libs/media/media.js it's now updated and has the new code.

It's strange that you still get this error that should happen only with the older file, in the new file on line 586 there is no left hand side assignment

Uncaught SyntaxError: invalid assignment left-hand side media.js:586:6

Can you please try from a different computer to rule out some network caching of the media.js fie?

Twilight-Computer commented 4 months ago

OK - completely rebooted my desktop to be sure. Firefox fails. Safari on my ipad fails. Edge (yuk) works and after reboot Chrome works. Tried on another machine and confirmed Edge / Chrome are OK but Firefox is not. Confirmed Safari failes on iphone as well.

givanz commented 4 months ago

Thanks for feedback, I was able to reproduce the bug on Firefox and fixed it in the last commit https://github.com/givanz/vvveb-admin-template/commit/916af350627c2c4730d1ca7a68920d8ac66559e1

If you don't want to wait for the next update you can update /public/admin/default/libs/media/media.js with https://raw.githubusercontent.com/givanz/vvveb-admin-template/master/libs/media/media.js

Twilight-Computer commented 4 months ago

This has resolved the issue - THANK YOU.

I will now proceed to merge the latest changes in - I have already noticed I will need to address the size of some images / logos.

Best Regards - Gary.

givanz commented 4 months ago

Default image resize method was changed to crop and resize to have uniform size for images with different aspect ratios.

You can switch to previous resize only method from site > media settings.