I currently have a Redux action that looks like this:
{
type: 'user/updateRequested',
payload: {name: 'Foo', avatar: File}
}
that File is not serializable so I'm wondering if there's a better way.
When the action is dispatched, three things happen:
- A reducer updates the
state.user.name
but ignoresavatar
- A Saga uploads the file to the API
- A Saga uses a FileReader to get a Data URL and dispatch another action (which causes
state.user.avatar
to be updated)
I'm never storing the File object in the store, it's only in actions.
Is there a better way or is this a use case where non-serializable actions are valid?
<input>
-myInput.files[0]
sagas read/upload that file from the action