aohua / redux-state-sync

A lightweight middleware to sync your redux state across browser tabs
MIT License
233 stars 29 forks source link

Feature Request: modify actions #90

Open rowrowrowrow opened 3 years ago

rowrowrowrow commented 3 years ago

Hi, thanks for the great package!

Would you consider adding a function to the configuration for modifying the actions before they are sent?

aohua commented 3 years ago

Yea, sure, but could you provide a use case?

rowrowrowrow commented 3 years ago

Of course and thanks!

I'd like to modify portions of state before they are sent depending on whether broadcastchannel is available and don't have a feasible way to separate those pieces otherwise. I.e. if there will be storage limitations that prevent the sending and receiving via the fallbacks for broadcastchannel.

rowrowrowrow commented 2 years ago

@aohua I see a few issues that might cause someone to want to modify an action before it's shared. Namely general performance, storage limitations when broadcast channel isn't available, and the structured clone algorithm causing errors if some part of an action is not clonable.

rowrowrowrow commented 1 year ago

@aohua bump