sherpal/LaminarSAPUI5Bindings

TimePicker needs to import localization assets

Closed this issue · 3 comments

DatePicker has this import in it which lazily (dynamically) imports all the locales:

  @js.native
  @JSImport("@ui5/webcomponents-localization/dist/Assets.js", JSImport.Default)
  object Localization extends js.Object

It appears that TimePicker also needs this import. I get this error if I try to render TimePicker() in my own project:

Screen Shot 2023-10-18 at 02 47 04

This error happens because UI5 is trying to load locales from the internet, while using an outdated version hardcoded in the URL. Why would they do that is another question, but they say we're supposed to avoid this altogether by doing that Assets.js import.

I think the reason TimePicker does not fail in your demo is that you also load DatePicker, which loads this necessary import. If I add DatePicker() in my project, the error goes away.

I tried to add that import to my own Scala.js code, but it does not work. UI5 docs say that it needs to be imported prior to registering the web component, or something like that, I guess the order is wrong? I'm not sure, but if I add that import "@ui5/webcomponents-localization/dist/Assets.js" to my index.js entry point, the problem solves itself too, even without DatePicker().

So, I'm like 90% sure that we need the same Assets.js JSImport in TimePicker as we have in DatePicker.

Ah yes that's annoying, especially if there is not way for a user to have a work around.
It's very possible that it's also needed. God know why they force us to make another import manually, but that's ok.

This is fixed (hopefully) in 1.17.1 :)

Thanks, seems to work now!