{"id":17579191,"url":"https://github.com/grahamtallen/mobx-undo-form","last_synced_at":"2026-04-19T14:31:58.500Z","repository":{"id":127707052,"uuid":"81256120","full_name":"grahamtallen/Mobx-Undo-Form","owner":"grahamtallen","description":"A form with undo-able actions. By unifying the entire application's observable state in a Global Store, you can revert the entire application's state using methods on the Global Store","archived":false,"fork":false,"pushed_at":"2017-03-02T07:16:11.000Z","size":4940,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T16:44:31.355Z","etag":null,"topics":["mobx","mobx-observable","react","react-native"],"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/grahamtallen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-07T21:28:15.000Z","updated_at":"2019-03-06T16:37:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"4604187e-4884-4603-b90c-96aba4196971","html_url":"https://github.com/grahamtallen/Mobx-Undo-Form","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/grahamtallen/Mobx-Undo-Form","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grahamtallen%2FMobx-Undo-Form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grahamtallen%2FMobx-Undo-Form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grahamtallen%2FMobx-Undo-Form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grahamtallen%2FMobx-Undo-Form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grahamtallen","download_url":"https://codeload.github.com/grahamtallen/Mobx-Undo-Form/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grahamtallen%2FMobx-Undo-Form/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32009840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["mobx","mobx-observable","react","react-native"],"created_at":"2024-10-22T00:44:03.438Z","updated_at":"2026-04-19T14:31:58.483Z","avatar_url":"https://github.com/grahamtallen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React-Native + Mobx Undo-able Form \n\nA form with undo-able actions. By unifying the entire application's observable state in a Global Store, you can revert the entire application's state using methods on the Global Store\n###Examples\n---\n\n```javascript\n    // in GlobalStore.js\n    \nclass GlobalStore {\n\n    @observable substores = {};\n\n    constructor() {\n        // After this global store class is instatiated via the constructor function,  map the substores to this object\n        this.substores = mapStores(subStores); \n\n        var {UiStore, UndoStore} = this.substores; // you can even deconstruct the state immidiately after instantiation,\n\n\n        reaction(() =\u003e this.snapshot, this.pushSnapshotAndSave); // and bind reactions to the global actions below\n\n        reaction(() =\u003e UndoStore.snapshots.length \u003e 1, (bool) =\u003e UiStore.displayUndo = bool); // or bind reactions to and from the substores\n\n        when(() =\u003e UiStore.loggedIn, this.displayUser); // this, referring to the GlobalStore and the methods bound to it\n\n    }\n    \n    ... // all other actions\n    \n    resetState() {\n        let {UndoStore, UiStore, ColorStore} = this.substores;\n        let lastSnapshot = UndoStore.snapshots.length \u003e 1 \u0026\u0026 UndoStore.snapshots[1];\n        if (lastSnapshot) {\n            \n            UiStore.autoSaveDrafts = false;\n\n            // here is where the entire application state is reset based on the last snapshot, see Snapshot.js\n            this.substores = resetSnapshot(lastSnapshot, this.substores);\n\n            UndoStore.popSnapshot();\n            UiStore.autoSaveDrafts = true;\n        }\n    }\n}\n  \n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrahamtallen%2Fmobx-undo-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrahamtallen%2Fmobx-undo-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrahamtallen%2Fmobx-undo-form/lists"}