NPM Resource Changed ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
18 Apr 2021

Pull Request for Issue #33063.

Summary of Changes

The com_media edit should use the whenDefined instead of DOMContentLoaded to solve some race conditions

Ref: https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/whenDefined

Testing Instructions

Go to Media Manager in Joomla 4 admin

Click to Edit the joomla_black.png file

When on the CROP tab, just keep pressing save, save save save until the 4 fields show NaN

Takes 3-6 clicks.

Actual result BEFORE applying this Pull Request

NaNs all over the form

Expected result AFTER applying this Pull Request

Real numbers only

Documentation Changes Required

@PhilETaylor

avatar dgrammatiko dgrammatiko - open - 18 Apr 2021
avatar dgrammatiko dgrammatiko - change - 18 Apr 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Apr 2021
Category JavaScript Repository NPM Change
avatar PhilETaylor
PhilETaylor - comment - 18 Apr 2021

Reload fast and multiple times the page. You shouldn't see any NaN values

I have seen it on page load (before this PR) but at other times too.

avatar dgrammatiko
dgrammatiko - comment - 18 Apr 2021

I have seen it on page load (before this PR) but at other times too.

Ok, what should be the right testing procedure. (I think I could replicate it on fast reloads or saves)

avatar PhilETaylor
PhilETaylor - comment - 18 Apr 2021

try this one #33063

avatar Quy Quy - change - 18 Apr 2021
Labels Added: NPM Resource Changed ?
avatar dgrammatiko dgrammatiko - change - 18 Apr 2021
The description was changed
avatar dgrammatiko dgrammatiko - edited - 18 Apr 2021
avatar dgrammatiko dgrammatiko - change - 18 Apr 2021
The description was changed
avatar dgrammatiko dgrammatiko - edited - 18 Apr 2021
avatar ceford
ceford - comment - 8 May 2021

I may be doing it wrong (again). I applied the patch, ran npm ci (even jinstall) and I still get NaN after some clicks. Also, if NaN is actually saved into joomla_black.png it kills the Media manager (blue line goes slowly across the top but nothing happens - no folders or images to choose from). I had to delete that image (only 3 bytes) and copy in one from another install to restore functionality.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/33192.

avatar dgrammatiko
dgrammatiko - comment - 8 May 2021

How did you actually apply the patch? Git or patch tester? I think patch tester is not safe for the build folder (but I maybe wrong I never used it)

avatar dgrammatiko
dgrammatiko - comment - 8 May 2021

@PhilETaylor can I have a test here? Thanks

avatar PhilETaylor
PhilETaylor - comment - 8 May 2021

Sorry first time seeing this PR (for a while).

avatar PhilETaylor
PhilETaylor - comment - 8 May 2021
rm -rf administrator/templates/atum/css; rm -rf templates/cassiopeia/css; rm -rf administrator/templates/system/css; rm -rf templates/system/css; rm -rf media/; rm -rf node_modules/; rm -rf libraries/vendor/;rm -f administrator/cache/autoload_psr4.php;rm -rf installation/template/css; composer install; npm ci

and then edited an image and on first page load I get a JS error

Screenshot 2021-05-08 at 18 19 58

avatar PhilETaylor
PhilETaylor - comment - 8 May 2021

One in every 7 page refreshes (approx) on the edit image page then gives NaN, the other 6 loads seem ok.

Screenshot 2021-05-08 at 18 24 51

avatar PhilETaylor
PhilETaylor - comment - 8 May 2021

Tabs also are not preserving state on page reload (unrelated to this PR probably, but when refreshing the page, the first tab is always selected and not the last clicked tab)

avatar PhilETaylor
PhilETaylor - comment - 8 May 2021

Also, if NaN is actually saved into joomla_black.png it kills the Media manager (blue line goes slowly across the top but nothing happens

I tried to fix that and was shot down by the maintainers. #33141 So this is still a problem that will come back to haunt Joomla 4 admins if they have any display errors enabled.

avatar PhilETaylor
PhilETaylor - comment - 8 May 2021

Also probably unrelated to this pr. When you click SAVE you get no feedback (the ajax call is ok, but there is no feedback so you dont know if it did anything or not.

avatar dgrammatiko
dgrammatiko - comment - 8 May 2021

@PhilETaylor @ceford it should be ok now, it seems that I can't type a word without a typo (the attribute is nomodule not nomodules)...

avatar dgrammatiko
dgrammatiko - comment - 8 May 2021

Also probably unrelated to this pr. When you click SAVE you get no feedback (the ajax call is ok, but there is no feedback so you dont know if it did anything or not.

There is PR that really implemented all those todos I left as a placeholder, someone should merge that one: #30511

avatar PhilETaylor
PhilETaylor - comment - 8 May 2021

JS console error gone.

looks totally different in the new template, but still get NaN on the edit page if I reload on the 6th. 7th, 13th and 20th of 23 refreshes...
Screenshot 2021-05-08 at 18 37 37

avatar joomla-cms-bot joomla-cms-bot - change - 8 May 2021
Category JavaScript Repository NPM Change Administration com_media Repository NPM Change JavaScript
avatar dgrammatiko
dgrammatiko - comment - 8 May 2021

I just dropped the SPA approach here and added a few more fuses, so hopefully this is ok now

avatar PhilETaylor
PhilETaylor - comment - 8 May 2021

Sorry - no :-(

Screen.Recording.2021-05-08.at.07.32.26.pm.mp4
avatar dgrammatiko
dgrammatiko - comment - 8 May 2021

Ehm how did you manage to click so fast on the save? The button gets disabled when pressed and enabled at the finish of the process...

avatar PhilETaylor
PhilETaylor - comment - 8 May 2021

CMD+R (browser refresh)

In fact the very first page load of the edit page after applying your latest changes loaded the page with NaN :-(

avatar ceford ceford - test_item - 12 May 2021 - Tested unsuccessfully
avatar ceford
ceford - comment - 12 May 2021

I have tested this item ? unsuccessfully on 94ddb70

After 6 quick clicks the four fields are empty and I get this:

Notice: exif_imagetype(): Error reading from /Users/ceford/Sites/j4test/images/joomla_black.png! in /Users/ceford/Sites/j4test/libraries/src/Helper/MediaHelper.php on line 74

Notice: getimagesize(): Error reading from /Users/ceford/Sites/j4test/images/joomla_black.png! in /Users/ceford/Sites/j4test/libraries/src/Image/Image.php on line 185

The joomla-black.png file is only 3 bytes and neither Reset nor Close work. Going back to the Media menu gives me a dead Media screen until I replace that bad file with a good copy.

Still needs some work!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/33192.

avatar dgrammatiko
dgrammatiko - comment - 23 Jul 2021

Please test #34885

avatar dgrammatiko dgrammatiko - close - 23 Jul 2021
avatar dgrammatiko dgrammatiko - change - 23 Jul 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-07-23 17:21:10
Closed_By dgrammatiko

Add a Comment

Login with GitHub to post a comment