Skip to content

Conversation

paultranvan
Copy link
Contributor

SharedWorker are not available everywhere:
https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker#browser_compatibility

It is typically not available at this moment on android mobile chrome
and opera, causing a blank screen for apps using the DataProxy on those
browsers.

Hence, we fallback on traditional web worker for such situation.

Note we do not store local data in web worker context.

Comlink API has a slight difference whether it is run in web worker or
shared worker context.
SharedWorker are not available everywhere:
https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker#browser_compatibility

It is typically not available at this moment on android mobile chrome
and opera, causing a blank screen for apps using the DataProxy on those
browsers.

Hence, we fallback on traditional web worker for such situation.
We force remote data, i.e. StackLink when using web worker, as it looks
less necessary / CPU consuming in non-shared workers, which happen
for old browsers and/or mobile browser
@paultranvan paultranvan merged commit 4c7bc36 into main Aug 25, 2025
1 check passed
paultranvan added a commit to cozy/cozy-libs that referenced this pull request Aug 28, 2025
Previously, the rendering of `DataProxyProvider` children were
conditioned by the initialization of the dataproxy.

It was because we wanted to avoid timing issues, were the App started to
use the DataProxy before it was actually ready.  See
https://github.com/cozy/cozy-libs/commit/
bdb1670

We later made it less strict, because if anything make the dataproxy not
initialized, nothing is displayed on the app side with no logs, making
it hard to debug for the developer.  See
#2801

However, we still met situations with no rendering, because the
dataproxy was not available at all:

- Public sharing: cozy/cozy-drive#3439
- Unsupported shared workers:
  cozy/cozy-web-data-proxy#36

So now, we always render children, and expect the `DataProxyLink` to
handle queries made on non-ready DataProxy by queuing them:
cozy/cozy-client#1622
paultranvan added a commit to cozy/cozy-libs that referenced this pull request Aug 28, 2025
Previously, the rendering of `DataProxyProvider` children were
conditioned by the initialization of the dataproxy.

It was because we wanted to avoid timing issues, were the App started to
use the DataProxy before it was actually ready.  See
https://github.com/cozy/cozy-libs/commit/
bdb1670

We later made it less strict, because if anything make the dataproxy not
initialized, nothing is displayed on the app side with no logs, making
it hard to debug for the developer.  See
#2801

However, we still met situations with no rendering, because the
dataproxy was not available at all:

- Public sharing: cozy/cozy-drive#3439
- Unsupported shared workers:
  cozy/cozy-web-data-proxy#36

So now, we always render children, and expect the `DataProxyLink` to
handle queries made on non-ready DataProxy by queuing them:
cozy/cozy-client#1622
paultranvan added a commit to cozy/cozy-libs that referenced this pull request Sep 19, 2025
Previously, the rendering of `DataProxyProvider` children were
conditioned by the initialization of the dataproxy.

It was because we wanted to avoid timing issues, were the App started to
use the DataProxy before it was actually ready.  See
https://github.com/cozy/cozy-libs/commit/
bdb1670

We later made it less strict, because if anything make the dataproxy not
initialized, nothing is displayed on the app side with no logs, making
it hard to debug for the developer.  See
#2801

However, we still met situations with no rendering, because the
dataproxy was not available at all:

- Public sharing: cozy/cozy-drive#3439
- Unsupported shared workers:
  cozy/cozy-web-data-proxy#36

So now, we always render children, and expect the `DataProxyLink` to
handle queries made on non-ready DataProxy by queuing them:
cozy/cozy-client#1622
rezk2ll pushed a commit to cozy/cozy-libs that referenced this pull request Sep 19, 2025
Previously, the rendering of `DataProxyProvider` children were
conditioned by the initialization of the dataproxy.

It was because we wanted to avoid timing issues, were the App started to
use the DataProxy before it was actually ready.  See
https://github.com/cozy/cozy-libs/commit/
bdb1670

We later made it less strict, because if anything make the dataproxy not
initialized, nothing is displayed on the app side with no logs, making
it hard to debug for the developer.  See
#2801

However, we still met situations with no rendering, because the
dataproxy was not available at all:

- Public sharing: cozy/cozy-drive#3439
- Unsupported shared workers:
  cozy/cozy-web-data-proxy#36

So now, we always render children, and expect the `DataProxyLink` to
handle queries made on non-ready DataProxy by queuing them:
cozy/cozy-client#1622
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants