Roblox / rodux

A state management library for Roblox Lua inspired by Redux
https://roblox.github.io/rodux
Apache License 2.0
250 stars 57 forks source link

Cherry-pick thunk extra-arg change onto 3.x patch branch #94

Closed tonycuadra closed 8 months ago

tonycuadra commented 10 months ago

I made this change early in 2022 but we never did upgrade lua-apps to Rodux 4.0 (I believe there were/probably-still-are some blocking issues).

Original PR: Add extra argument to thunk middleware (#69)

This feature is equivalent to what is available in newer versions of Redux: https://github.com/reduxjs/redux-thunk#injecting-a-custom-argument

It allows arbitrary parameters to injected into thunks via a table passed in at Rodux initialization time (useful for passing in services or anything else we might want to mock for tests).

It can replace other custom middlewares we've written to achieve the same thing (e.g. PaginatedFetchThunk.middleware, AvatarEditorServiceThunk.middleware, RNAdapterThunk.middleware)

ZoteTheMighty commented 8 months ago

I remember this from before, this looks reasonable to me

github-actions[bot] commented 8 months ago

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.