SOLVED: Form: Flatpickr language files loading from wrong URL

Browser: Chrome 110
OS: macOS
URL: Any site using Flatpickr l10n

When using Flatpickr with another language, the URL requested has a non-existing query (https://npmcdn.com/flatpickr@4.6.13/dist/l10n/da.js?ver=4.6.13) causing the request to redirect to https://npmcdn.com/flatpickr@4.6.13/dist/l10n/da.js which takes from 500 ms to 2.5s meaning that the page load speed is being drastically slow.

The worst part about this harmless issue, is that it is blocking the rest of the scripts such as lazy loading and even some times the pictures, making the user experience terrible.

As a quickfix for the current site i am working on, i’ve passed “null” to the 4th argument in the wp_enqueue_script function in includes > elements > form.php (line 48) but this is not maintainable as this will be overwritten if i update Bricks, but i can’t wait for an official fix because i need to launch this site soon.

I hope this will be fixed in v. 11.1

Hi Sillo,
Thanks so much for your report!

Unfortunately, I cannot reproduce the issue.

I placed the two script tags in my footer scripts and changed “XX” to “da” in both places:

Best regards,
timmse

Hey Timmse.

I can see in the left column that 2 requests are made to da.js, but i can’t see the response of the top one in your screenshot. Can you try and look at that?

The request should originally only be made 1 time. I’m sure that the reason you got 2, is because the first one redirected to the url without the query parameter.

Note: This is not specific to da at all, but generally the implementation of the script, meaning this will happen to any language requested.

The following code in includes/elements/form.php specifically tells Wordpress to append a “version number” to the requested URL.

wp_enqueue_script( 'bricks-flatpickr-l10n', "https://npmcdn.com/flatpickr@4.6.13/dist/l10n/$l10n.js", [ 'bricks-flatpickr' ], "4.6.13" );

The 4th parameter here is the version number. This should be null.

Hey Sillo,
Sorry - I was a bit under the weather yesterday -.-

You’re right - I’ll create a task :v:
Have a nice weekend!

Hey Timsse.

No worries, it happens :smiley:

Thanks alot, and you too :slight_smile:

Hi Sillo,
We fixed this issue in Bricks 1.12, now available as a one-click update in your WordPress Dashboard.

Changelog: Bricks 1.12 Changelog – Bricks

Please let us know if you are still experiencing issues.

Best regards,
timmse