-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WASM demo takes 40 seconds to load and is not interactive #2769
Comments
Without callbacks we can possibly make it work by having an introspecting adapter like you added in #2766 |
Hello, can I take this one? My WASM demo is now running I think short-term solutions has already been implemented by @sffc and implementing the medium term solution remains |
Yes! This should be a good starter project now that you have the wasm running in your development environment. Happy to review an implementation plan or answer any questions. |
Here is my findings so far, feel free to point anything out:
Thoughts and question about second point:
|
We don't have callback support for Diplomat and are unlikely to have it soon. The introspection should be done on the JS side using the APIs from icu_capi, we can add more if needed. |
We could create an adapter which wraps our pub struct DynamicLocaleAdapter<P> {
inner: P,
}
impl<P> DynamicLocaleLoaderAdapter<P> {
pub fn new(provider: P) -> Self {
Self { inner: provider }
}
}
impl<P, M> DataProvider<M> for DynamicLocaleLoaderAdapter<P>
where
P: DataProvider<M>,
M: KeyedDataMarker,
{
fn load(&self, req: DataRequest) -> Result<DataResponse<M>, DataError> {
let response = self.inner.load(req);
if let Ok(ref data_response) = response {
if data_response.metadata.locale.is_langid_und() {
// Do something here
}
}
response
}
} This needs to be written in our Thoughts regarding this? |
This could work, but another approach that might be simpler would be
Also, the bundle should be in postcard format, not JSON, and I think for the purposes of this demo it can contain all keys so we need to load it only one for all components. |
Thanks @sffc for suggesting a much easier approach. Though I have couple of points:
|
Yes, we have the ccp.postcard sample file. Part of this project is generating similar files for all other locales. They can likely be hosted in the same place as the WASM code. |
So basically I have to expose the |
The data files should be generated during the build. You shouldn't need to run Datagen in WASM. |
I could do the following in
Now running PS: Thank you for being so patient and thoughtful 🚀 |
@sffc Performance issue may occur just in one case: If the user doesn't have |
Generating the files via an |
The LocaleFallbacker API should silence the errors and run the fallback algorithm; are you using it? I think in FFI there is also |
|
@sffc Fixed, finally!!!! |
During the 40 seconds it takes to download the latest full-data WASM demo, the page is not interactive.
Short-term solutions:
Medium-term solution: download the locale data on demand. Steps to make that work:
fetch
es the requested language pack when that callback occurs, and then re-tries the renderingSteps 1 and 3 should already be achievable via public APIs. Step 2 is doable in Rust but may need an FFI hook. It will be easier to write once callback support is added.
The text was updated successfully, but these errors were encountered: