contentful / ui-extensions-sdk

A JavaScript library to develop custom apps for Contentful
https://www.contentful.com/developers/docs/extensibility/app-framework/
MIT License
125 stars 31 forks source link

`init` doesn't work when called too late #1045

Closed r00dY closed 2 years ago

r00dY commented 2 years ago

Hey,

This issue is related to https://github.com/contentful/ui-extensions-sdk/issues/344, (mentioning @pixelass and @Jwhiles)

It seems that init method from Contentful App SDK is listening to connect message from parent window. However, sometimes, init can be called later. The above-mentioned issue is a good example of that.

Unfortunately when init is called after connect message is run, then it doesn't work. Everything is silent, no timeout, nothing is happening and app is not working.

It seemed to work though. Have something changed?

Best, Andrzej

Jwhiles commented 2 years ago

Hey @r00dY - if this still an issue for you, can you provide a minimal setup for replicating the issues? I believe that the sdk should be storing all messages before init is called, so they can be handled at the appropriate time.

andipaetzold commented 2 years ago

Closing because of inactivity. Feel free to reopen if you are still running into issues.

r00dY commented 2 years ago

@Jwhiles what if connect message is sent before your SDK is loaded? I must lazy load your SDK because of #1046 and message comes before the load.

jeffyamada commented 2 years ago

@r00dY I think

@Jwhiles what if connect message is sent before your SDK is loaded? I must lazy load your SDK because of #1046 and message comes before the load.

@r00dY I think I'm experiencing this. It's VERY frustrating - and I can't quite pin down when/how to avoid missing this call so my extension only works 1/4 of the time...did you find any solutions?

andipaetzold commented 2 years ago

We are aware of the issues and are currently working on a solution. We hope to release an update of the App SDK at some point next month but cannot provide an ETA just yet.

I don't think there is a workaround for this problem. Currently, the App SDK must be included in the first chunk loaded by the app. If the SDK is loaded later (e.g. via dynamic loading, lazy loading), things become flaky.

(Reopening this issue to communicate the status of our work.)

andipaetzold commented 2 years ago

We released an alpha version that hopefully resolves your issues: 4.10.0-alpha.1. Would be great to hear from you folks whether you are still running into problems with that update.

You can install the alpha by running npm install @contentful/app-sdk@4.10.0-alpha.1

andipaetzold commented 2 years ago

The change is now available in 4.11.0.