- Issue created by @e0ipso
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
@e0ipso Can you attach a patch with the component?
- e0ipso Can Picafort
@penyaskito, you can get the component definitions:
composer require drupal/sdc_examples drush pm:enable sdc_examples_replacements
Then fetch the MR to use those components in your Umami homepage.
- last update
over 1 year ago 29,359 pass, 6 fail - @e0ipso opened merge request.
- Status changed to Needs work
over 1 year ago 8:18pm 1 May 2023 - πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
What I did:
git checkout -b '3357383-localeparsejsfile-cannot-open' --track drupal-3357383/'3357383-localeparsejsfile-cannot-open' ddev composer require drush/drush ddev drush si --yes demo_umami cd modules && git clone git@git.drupal.org:project/sdc_examples.git ddev drush en sdc sdc_examples --yes ddev drush uli
Go to Spanish in the language switcher.
Click compulsively the new button.What I see makes sense to me. No errors on console or watchdog.
Wondering if this is because I used drush, or the problem might be in your env? - πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
Oh I see that was not the right module...
ddev drush en sdc_examples_replacements
Clear caches on "Performance" page.
Go to homepageNow I see a different issue (404)
https://drupal10.ddev.site/modules/sdc_examples/sdc_examples_replacements/components/my-button--primary/my-button--primary.js?ru008s net::ERR_ABORTED 404
The file isn't in
modules/sdc_examples/sdc_examples_replacements/components/my-button--primary/
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
https://git.drupalcode.org/project/sdc_examples/-/blob/1.x/sdc_examples_...
Defines the js. The js is included properly, but it's missing.
edit
modules/sdc_examples/sdc_examples_replacements/components/my-button--primary/my-button--primary.js
See once() method call comment, but I'm not sure if that's expected or not. But the original my-button.js is there:(function (Drupal, once) { Drupal.behaviors.button = { attach: function attach(context) { let counter = 0; // The original my-button.js is still there! So we need a different once. const [button] = once('my-overridden-button', '.my-button', context); if (!button) { return; } button.addEventListener('click', function (event) { event.preventDefault(); counter++; this.innerHTML = this.innerHTML.replace(/ \([0-9]*\)$/, '') + ' (' + counter + ') ' + Drupal.t('This is a new string in my component override'); }); }, }; })(Drupal, once);
And I don't see any other errors
Actually I can translate this properly, and works.
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
So the expected behaviour is working when the js is there.
If the js is missing as it is right now, I don't see any errors, but makes sense to have them when trying to load the js.
If I delete an umami js defined in libraries, I see the same errors than I see with this missing file. So IMHO sdc is consistent with how core handles this, and this is a works as designed.
- Status changed to Closed: works as designed
over 1 year ago 3:01pm 2 May 2023 - e0ipso Can Picafort
@penyaskito and I got together to investigate this. The crux of this is that the replacement component declares (in libraryOverrides) that it's providing a JS file that does not exist in the file system.
Given that the behavior in this situation is the same as a missing JS file in a traditional library definition, I propose closing this as Works as Designed.