{"id":13796617,"url":"https://github.com/fabiospampinato/unstated-suspense","last_synced_at":"2025-05-13T00:31:02.873Z","repository":{"id":57386891,"uuid":"150239351","full_name":"fabiospampinato/unstated-suspense","owner":"fabiospampinato","description":"Suspend/unsuspend updates propagation from your containers.","archived":true,"fork":false,"pushed_at":"2018-12-10T17:05:19.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-24T18:05:32.260Z","etag":null,"topics":["hoc","performance","react","suspend","unstated"],"latest_commit_sha":null,"homepage":"","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/fabiospampinato.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":"2018-09-25T09:23:18.000Z","updated_at":"2023-12-11T16:14:03.000Z","dependencies_parsed_at":"2022-09-26T16:50:45.405Z","dependency_job_id":null,"html_url":"https://github.com/fabiospampinato/unstated-suspense","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Funstated-suspense","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Funstated-suspense/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Funstated-suspense/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Funstated-suspense/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/unstated-suspense/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225159873,"owners_count":17430201,"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":["hoc","performance","react","suspend","unstated"],"created_at":"2024-08-03T23:01:12.688Z","updated_at":"2024-11-18T10:31:29.162Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# Unstated Suspense\n\nSuspend/unsuspend updates propagation from your containers.\n\nIt allows you to update the state multiple times while still triggering only one update of the components.\n\n## Install\n\n```sh\nnpm install --save unstated-suspense\n```\n\n## Usage\n\n```ts\nimport {Container} from 'unstated-suspense';\n\nclass App extends Container {\n  state = { foo: 1, bar: 2 };\n  update () {\n    this.suspend (); // After calling `suspend` the components won't be notified of any state update\n    this.setFoo ( 11 ); // This will change the state, but it won't trigger an update of the components\n    this.setBar ( 12 ); // This will change the state, but it won't trigger an update of the components\n    this.unsuspend (); // Now updates are no longer suspended. If the state has been updated it will notify the components, just once (instead of twice in this particular case)\n  }\n  setFoo ( foo ) {\n    this.setState ({ foo });\n  }\n  setBar ( bar ) {\n    this.setState ({ bar });\n  }\n}\n```\n\n**Note**: If you call `suspend` N times you should call `unsuspend` N time also to resume updates propagation.\n\n\n## Related\n\n- **[unstated-with-containers](https://github.com/fabiospampinato/unstated-with-containers)**: Higher-Order Component for subscribing to containers.\n- **[unstated-connect2](https://github.com/fabiospampinato/unstated-connect2)**: Connect containers to components, without sacrificing performance.\n- **[unstated-hmr](https://github.com/fabiospampinato/unstated-hmr)**: Preserve containers' states across Hot-Module-Replacements.\n- **[unstated-compose](https://github.com/fabiospampinato/unstated-compose)**: Compose multiple containers into one.\n- **[unstated-compose-suspense](https://github.com/fabiospampinato/unstated-compose-suspense)**: Add suspend/unsuspend support to `unstated-compose`.\n- **[unstated-compose-suspense-middleware](https://github.com/fabiospampinato/unstated-compose-suspense-middleware)**: Add middlewares support to `unstated-compose-suspense`.\n- **[unstated-suspense-autosuspend](https://github.com/fabiospampinato/unstated-suspense-autosuspend)**: Automatically use unstated-suspense on all your container's API methods.\n- **[unstated-suspense-middleware](https://github.com/fabiospampinato/unstated-suspense-middleware)**: Add middlewares support to `unstated-suspense`.\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Funstated-suspense","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Funstated-suspense","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Funstated-suspense/lists"}