Skip to content
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

How to prevent auto releaseProxy? #667

Open
HuakunShen opened this issue Aug 11, 2024 · 0 comments
Open

How to prevent auto releaseProxy? #667

HuakunShen opened this issue Aug 11, 2024 · 0 comments

Comments

@HuakunShen
Copy link

I am using comlink to communicate between a web page and an embedded iframe. The iframe calls functions exposed from the main page. Everything works fine when iframe web page is running on dev server (vite), but stops working in production build.

In production build, the API call to main page works for the first ~25ms then stops working (this is not a stable behaviour, sometimes longer). After inspecting all messages from iframe I found a message with type RELEASE.

Then I found this in comlink's docs.

If the browser supports the WeakRef proposal, releaseProxy will be called automatically when the proxy created by wrap() gets garbage collected.

Is there a way to prevent auto release? The iframe page is like an extension, it needs to call APIs exposed from main page throughout its lifetime.

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

No branches or pull requests

1 participant