-
Notifications
You must be signed in to change notification settings - Fork 180
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
Multiple Event Message Issues in "webext-redux": "3.0.0-mv3.0" #303
Comments
Thanks for the report! I missed this in my testing because I didn't check what happens when non-webext redux messages are received by the service worker. It looks like this code is the cause: https://github.com/tshaddix/webext-redux/blob/master/src/listener.js#L10-L11 To fix this, the function above needs to conditionally return true, only for messages that will be handled by webext-redux. I'll think through how to implement this. In the meantime you can ignore the error -- it shouldn't cause any issues in your app. |
Thanks for your response, I'll take that in mind! 🤠 |
fixes #303 The issue was that the deferred listener abstraction would `return true` (telling the browser to expect an async response) for every message, even if the messages were not from the library. In `wrapStore()`, those messages would be ignored causing the browser to log an error: Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received This is mostly harmless, but it's better to avoid the error. In this commit, `createDeferredListener()` now takes a `filter` function that determines if the message will be handled so that messages from outside the library can be ignored. This requires a breaking change: moving the `channelName` argument to `createWrapStore()`. This is required since the filter function needs to know which channel to expect before `wrapStore()` is called.
Created a PR to address this if you're curious: #304 |
The fix has been published in 4.0.0, sorry for the long wait! |
Hello,
I’m experiencing several errors with the "webext-redux": "3.0.0-mv3.0" version, primarily related to event messages. The errors are persistent and occur under specific conditions. Below is an example:
Based on my research, I suspect these issues might be caused by the absence of the
return true;
statement in the message handler, as shown in the following code snippet:if (request.message === 'webext-example') { doAction(); return true; }
This statement is crucial to ensure proper message handling, especially when dealing with asynchronous actions.
Any help or guidance on resolving this would be greatly appreciated!
The text was updated successfully, but these errors were encountered: