Closed braska closed 6 years ago
Hi, @braska.
Could you tell me a use case for this?
Would invalidate
clean only MY_CUSTOM_ACTION
fulfilled state or all actions?
Would invalidate
clean only fulfilled state or all states?
Some words about use case:
I am using redux-saga-thunk to do SSR.
And I want to implement following behaviour:
I have some page with info about company (/companies/:id
).
If user opens this page for the first time or in new tab (in other words, using SSR), I don't want to start API request to fetch company info, because required info already in state. For that I am using fulfilled
state - I am fetch company info only in case if fulfilled
= false. If page is server-side rendered then fulfilled
= true on client-side (redux state transferred from server to client in window.__INITIAL_STATE__
).
But what if user leaves this page (via client-side routing) and then turns back to it? Fetching doesn't start because fulfilled
already equals true
.
For resolve this issue I want to invalidate state of LOAD_COMPANY_INFO
action on execution componentWillUnmount
of CompanyPage
component.
Would invalidate
clean only MY_CUSTOM_ACTION
fulfilled state or all actions? and Would invalidate
clean only fulfilled state or all states?
All states, but only for MY_CUSTOM_ACTION
.
I see.
I think clean('ACTION_TYPE')
would be good.
Do you want to work on that?
My current project depends on this feature. Currently I am using a bunch of workarounds and it is frustrating me. I will be glad to work on this, but don't have enough time to give any guarantees.
More over another issue (#20) is more important for me. And I want to start working on #20.
I would start when I have some free time.
What do you thing about possibility to implement exportable action (for example
invalidate
) that can be dispatched from user space to invalidate state of specific action?For example:
Clicking on button will trigger setting
fulfilled
tofalse
.