{"id":20020123,"url":"https://github.com/wonism/redux-flush","last_synced_at":"2025-05-04T23:32:40.046Z","repository":{"id":33140573,"uuid":"153006465","full_name":"wonism/redux-flush","owner":"wonism","description":"Redux middleware for flushing frequent actions. It optimizes the redux based application via reducing re-rendering caused of changed state.","archived":false,"fork":false,"pushed_at":"2023-01-04T15:14:26.000Z","size":3722,"stargazers_count":4,"open_issues_count":19,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-24T16:36:28.622Z","etag":null,"topics":["debouncing","flush","optimization","redux","redux-flush","redux-middleware","throttling"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wonism.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-14T18:39:09.000Z","updated_at":"2023-03-10T08:23:34.000Z","dependencies_parsed_at":"2023-01-14T23:35:05.538Z","dependency_job_id":null,"html_url":"https://github.com/wonism/redux-flush","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonism%2Fredux-flush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonism%2Fredux-flush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonism%2Fredux-flush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonism%2Fredux-flush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wonism","download_url":"https://codeload.github.com/wonism/redux-flush/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252414632,"owners_count":21744145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["debouncing","flush","optimization","redux","redux-flush","redux-middleware","throttling"],"created_at":"2024-11-13T08:29:57.720Z","updated_at":"2025-05-04T23:32:38.853Z","avatar_url":"https://github.com/wonism.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redux Flush\n\u003e Redux middleware for flushing frequent actions.\n\u003e It optimizes the redux based application via reducing re-rendering caused of changed state.\n\n[![npm version](https://badge.fury.io/js/redux-flush.svg)](https://badge.fury.io/js/redux-flush)\n[![Build Status](https://travis-ci.org/wonism/redux-flush.svg)](https://travis-ci.org/wonism/redux-flush)\n\n## Installation\n```\n$ npm i -S redux-flush\n```\n\n## Demo\n```\n$ npm run dev\n# and visit localhost:7777\n```\n\n## Usage\n__⚠ Caution__\n\nBasically, The action with `meta.flush = true` will have array-like payload.\nSo, when you write reducers, please be **CAREFUL**.\n\nIf you want to pass just action payload, you can add `omitKey`. And it **MUST** be array.\n\n__Example__\n\n![Example Image](https://raw.githubusercontent.com/wonism/redux-flush/master/demo/redux-flush.gif)\n\n__Example with codes__\n\n```js\nimport { combineReducers, createStore, applyMiddleware, compose } from 'redux';\nimport { composeWithDevTools } from 'redux-devtools-extension';\nimport createFlush from 'redux-flush/es';\n// or\n// import createFlush from 'redux-flush';\n\nconst reducers = combineReducers({\n  app: (state = {}, { type, num, rand }) =\u003e {\n    // payload will be delivered as a stream\n    if (type === 'CLICK_EVENT') {\n      return {\n        ...state,\n        num,\n        rand: [...state.rand, ...rand],\n      };\n    }\n\n    return state;\n  },\n});\n\nconst isProduction = process.env.NODE_ENV === 'production';\n\nconst flushMiddleware = createFlush();\nconst middleware = applyMiddleware(flushMiddleware);\nconst composeEnhancers = !isProduction ? global.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || composeWithDevTools : compose;\nconst store = createStore(reducers, { app: { num: -1, rand: [], } }, composeEnhancers(middleware));\n\nstore.subscribe(() =\u003e {\n  const state = store.getState();\n  const { num, rand } = state.app;\n\n  document.getElementById('number').textContent = num;\n  document.getElementById('random').textContent = rand.join(', ');\n});\n\n{\n  let num = 0;\n\n  document.querySelector('button').addEventListener('click', () =\u003e {\n    store.dispatch({\n      type: 'CLICK_EVENT',\n      num,\n      rand: Math.floor(Math.random() * 10) + 1,\n      meta: {\n        flush: true,\n        interval: 1000,\n        omitKey: ['num'],\n      },\n    });\n\n    num += 1;\n  });\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonism%2Fredux-flush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwonism%2Fredux-flush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonism%2Fredux-flush/lists"}