{"id":42830722,"url":"https://github.com/weavedev/redux-async","last_synced_at":"2026-01-30T11:27:41.292Z","repository":{"id":40887549,"uuid":"234104296","full_name":"weavedev/redux-async","owner":"weavedev","description":"Async function wrapper for redux powered by redux-saga","archived":false,"fork":false,"pushed_at":"2023-01-09T09:10:32.000Z","size":809,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-28T11:39:37.221Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weavedev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-15T14:58:11.000Z","updated_at":"2022-10-03T11:52:26.000Z","dependencies_parsed_at":"2023-02-08T09:30:30.323Z","dependency_job_id":null,"html_url":"https://github.com/weavedev/redux-async","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/weavedev/redux-async","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavedev%2Fredux-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavedev%2Fredux-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavedev%2Fredux-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavedev%2Fredux-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weavedev","download_url":"https://codeload.github.com/weavedev/redux-async/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavedev%2Fredux-async/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28911821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T08:15:08.179Z","status":"ssl_error","status_checked_at":"2026-01-30T08:14:31.507Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-30T11:27:40.593Z","updated_at":"2026-01-30T11:27:41.285Z","avatar_url":"https://github.com/weavedev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-async\n\n[![Build Status - Travis CI](https://img.shields.io/travis/weavedev/redux-async.svg)](https://travis-ci.org/weavedev/redux-async)\n[![Test Coverage - Code Climate](https://img.shields.io/codeclimate/coverage/weavedev/redux-async.svg)](https://codeclimate.com/github/weavedev/redux-async/test_coverage)\n[![MIT](https://img.shields.io/github/license/weavedev/redux-async.svg)](https://github.com/weavedev/redux-async/blob/master/LICENSE)\n[![NPM](https://img.shields.io/npm/v/@weavedev/redux-async.svg)](https://www.npmjs.com/package/@weavedev/redux-async)\n\nDefault reducer with reset functionality for [Redux Toolkit's createAsyncThunk](https://redux-toolkit.js.org/api/createAsyncThunk)\n\n## Install\n\n```\nnpm i @weavedev/redux-async\n```\n\n## API documentation\n\nWe generate API documentation with [TypeDoc](https://typedoc.org).\n\n[![API Documentation](https://img.shields.io/badge/API-Documentation-blue?style=for-the-badge\u0026logo=typescript)](https://weavedev.github.io/redux-async/)\n\n## Creating\n\nIn this example we create a reducer from a thunk. The async function inside the thunk will trigger its callback after 3 seconds.\n\n```ts\nimport { createAsyncThunk } from '@reduxjs/toolkit';\nimport { createAsyncReducer } from '@weavedev/redux-async';\n\n// First, create the thunk with @reduxjs/toolkit's createAsyncThunk\n//     Docs, see: https://redux-toolkit.js.org/api/createAsyncThunk\nexport const runSayHello = createAsyncThunk(\n    'say/hello',\n    async (name: string): Promise\u003cstring\u003e =\u003e {\n        // This promise waits 3 seconds and then returns\n        return new Promise((resolve: ((value: string) =\u003e void)): void =\u003e {\n            setTimeout(() =\u003e {\n                resolve(`Hey, ${name}!`);\n            }, 3000);\n        });\n    },\n);\n\n// Then create the reducer from the thunk\nexport const sayHello = createAsyncReducer(runSayHello);\n```\n\n## Triggering\n\nYou can run your async function by dispatching the thunk. If your `Promise` expects a parameter, you can pass it to the thunk.\n\n```ts\nimport { runSayHello } from './runSayHello';\nimport { store } from './store';\n\n// Dispatch the thunk on your store\nstore.dispatch(runSayHello('Dave'));\n```\n\nFor more information, see [Redux Toolkit: createAsyncThunk - Overview](https://redux-toolkit.js.org/api/createAsyncThunk#overview).\n\n## Resetting\n\nIf you pass an action as the second argument to `createAsyncReducer` the generated reducer will reset itself to its initial state when this action is dispatched.\n\nIf this is done while the thunk is `'pending'`, the corresponding `'rejected'` or `'fulfilled'` will be ignored (the thunk will still fire the action, but the state will not update).\n\n```ts\nimport { createAction, createAsyncThunk } from '@reduxjs/toolkit';\nimport { createAsyncReducer } from '@weavedev/redux-async';\n\n// First, create the thunk with @reduxjs/toolkit's createAsyncThunk\n//     Docs, see: https://redux-toolkit.js.org/api/createAsyncThunk\nexport const runSayHello = createAsyncThunk(\n    'say/hello',\n    async (name: string): Promise\u003cstring\u003e =\u003e {\n        // This promise waits 3 seconds and then returns\n        return new Promise((resolve: ((value: string) =\u003e void)): void =\u003e {\n            setTimeout(() =\u003e {\n                resolve(`Hey, ${name}!`);\n            }, 3000);\n        });\n    },\n);\n\n// Create a reset action\n//     We suggest adding `/reset` or `/initial` after your thunk action string\nexport const resetSayHello = createAction('say/hello/reset');\n\n// Then create the reducer from the thunk and the reset action\nexport const sayHello = createAsyncReducer(runSayHello, resetSayHello);\n```\n\nTo reset the state on your reducer, simply dispatch the reset action\n\n```ts\nstore.dispatch(resetSayHello());\n```\n\n## State\n\nThe state output contains the following fields\n\n### `error?: any`\n\nThe reducer will contain the rejected or thrown value in the `error` field if the `Promise` has rejected / thrown. This value will be cleared if you dispatch the thunk again (or on reset).\n\n### `result?: ThunkResult`\n\nThe reducer will contain the returned value in the `result` field if the `Promise` has resolved. This value will be cleared if you dispatch the thunk again (or on reset).\n\n### `meta`\n\nThe `meta` field contains a copy of the data in the `meta` field in [Thunk's Promise Lifecycle Actions](https://redux-toolkit.js.org/api/createAsyncThunk#promise-lifecycle-actions).\n\nFor example; when pending the `meta` field contains the following values:\n\n```ts\nrequestId: string;\narg: ThunkArg;\n```\n\nThe `meta` field also contains the `requestStatus` with the current state of the thunk.\n\n```ts\nrequestStatus: 'initial' | 'pending' | 'fulfilled' | 'rejected';\n```\n\n#### `meta.requestStatus: 'initial'`\n\nThis is the `requestStatus` in the reducer, or the state after the reset action has been dispatched.\n\n#### `meta.requestStatus: 'pending'`\n\nThis is the `requestStatus` in reducer while we are waiting for the `Promise` to resolve (or `throw`).\n\nYou can implement a busy indicator by checking `meta.requestStatus === 'pending'`.\n\n#### `meta.requestStatus: 'fulfilled'`\n\nThis is the `requestStatus` in the reducer after the `Promise` has resolved. The reducer will also contain the returned value in the `result` field.\n\n#### `meta.requestStatus: 'rejected'`\n\nThis is the `requestStatus` in the reducer after the `Promise` has rejected / thrown. The reducer will also contain the rejected or thrown value in the `error` field.\n\n## License\n\n[MIT](https://github.com/weavedev/redux-async/blob/master/LICENSE)\n\nMade by [Paul Gerarts](https://github.com/gerarts) and [Weave](https://weave.nl)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweavedev%2Fredux-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweavedev%2Fredux-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweavedev%2Fredux-async/lists"}