Download Latest Version v4.0.0 source code.tar.gz (81.0 kB)
Email in envelope

Get an email when there's a new version of WebExt Redux

Home / v3.0.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2024-07-10 3.1 kB
v3.0.0 source code.tar.gz 2024-07-10 80.6 kB
v3.0.0 source code.zip 2024-07-10 98.5 kB
Totals: 3 Items   182.2 kB 0

v3.0.0

Webext-redux now supports manifest v3! Here's a quick guide on how to update for webext-redux 3.0.0. Full changelog below.

Use createWrapStore() to init wrapStore

:::diff
  import {
-   wrapStore,
+   createWrapStore
  } from "webext-redux";

+ const wrapStore = createWrapStore();
  wrapStore(store);

Remember to call createWrapStore() at the top-level.

Correct 👍

:::js
const wrapStore = createWrapStore()

chrome.storage.local.get('state').then(({ state }) => {
  const store = ...
  wrapStore(store);
});

Incorrect 👎

:::js
chrome.storage.local.get('state').then(({ state }) => {
  const store = ...
  // Incorrect: createWrapStore must be called synchronously
  const wrapStore = createWrapStore()
  wrapStore(store);
});

Replace portName with channelName

:::diff
  Store({
-   portName: 'custom-name'
+   channelName: 'custom-name'
  })

  wrapStore(store, {
-   portName: 'custom-name'
+   channelName: 'custom-name'
  })

Breaking Changes

  • Option portName renamed to channelName. For manifest v3 support, webext-redux no longer uses ports. Thus, "portName" doesn't describe the purpose anymore. It still allows multiple independent stores or wrapStore calls. #297.
  • Function wrapStore is now created by createWrapStore. This new function sets up listeners to ensure webext-redux works in manifest v3. createWrapStore must be called synchronously at the top level of your extension, just like browser event handlers. More details in #297.
  • Removed external messaging (listening or passing store updates to other extensions). Since ports are no longer used, there's no mechanism to track which external contexts are still subscribed to updates. If you have a use case for this feature, please open an issue and we'll brainstorm ways to re-implement this. Details in 5c7d998f5ccf94b3b905588009b04f558c8ec27d.

Fixes / Updates

  • Bind getState and subscribe in Store constructor (@dermeck in https://github.com/tshaddix/webext-redux/pull/289). This fixes compatibility with react-redux v8.
  • Update Redux peer dependency to include v5 (@SidneyNemzer in https://github.com/tshaddix/webext-redux/pull/299).
  • Internal string constants changed. These aren't part of the public API, but I figured I'd mention them here just in case someone depends on them. See the change in 7fe2113cc31a70188ade7e04289344f60ae33fc5.
  • Minor/patch updates for some dependencies. #300.

New Contributors

All Changes: https://github.com/tshaddix/webext-redux/compare/v2.1.9...v3.0.0

Source: README.md, updated 2024-07-10