{"id":20328896,"url":"https://github.com/kaliber5/tracked-immutable","last_synced_at":"2025-03-04T11:47:09.321Z","repository":{"id":44658573,"uuid":"451395842","full_name":"kaliber5/tracked-immutable","owner":"kaliber5","description":"Enable deep, deduped auto-tracking of immutable data.","archived":false,"fork":false,"pushed_at":"2022-02-01T17:17:23.000Z","size":455,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-14T14:59:26.234Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/kaliber5.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-24T09:20:51.000Z","updated_at":"2022-08-30T09:50:38.000Z","dependencies_parsed_at":"2022-08-30T23:30:13.063Z","dependency_job_id":null,"html_url":"https://github.com/kaliber5/tracked-immutable","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/kaliber5%2Ftracked-immutable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaliber5%2Ftracked-immutable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaliber5%2Ftracked-immutable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaliber5%2Ftracked-immutable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaliber5","download_url":"https://codeload.github.com/kaliber5/tracked-immutable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241844286,"owners_count":20029611,"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":[],"created_at":"2024-11-14T20:08:23.637Z","updated_at":"2025-03-04T11:47:09.299Z","avatar_url":"https://github.com/kaliber5.png","language":"JavaScript","readme":"tracked-immutable\n==============================================================================\n\nEnable deep, deduped auto-tracking of immutable data.\n\nWhen you are working with immutable data (POJOs, Arrays, rich class instances, or a mix thereof), which means every time\nthe data changes you get a completely new instance instead of directly mutating properties, you can make this work with\nEmber's autotracking by assigning the new instance to a `@tracked` property as usual. However, that comes with the caveat\nthat *everything* depending on that data will rerender, whether the actually used value has changed or not.\n\n```js\nclass MyComponent extends Component {\n  @tracked person = { \n    firstName: null,\n    lastName: null\n  };\n  \n  @action\n  updateFirstName(firstName) {\n    this.person = {\n      ...this.person,\n      firstName\n    };\n  }\n\n  @action\n  updateLastName(lastName) {\n    this.person = {\n      ...this.person,\n      lastName\n    };\n  }\n}\n```\n\nHere whenever the user updates e.g. the first name, the template that consumes these values will correctly\nupdate, however it will re-render both the first and last name (as the whole person object has changed), even is the \nlast name's *actual value* hasn't changed.\n\nIn this trivial example, this is not a big issue. But when things are more complex, and re-rendering becomes a costly \noperation, you want *only* what has really changed to re-render. \n\nThis is what `@trackedImmutable` is for. It will automatically track all the (nested) properties at a granular level, \ncausing only changed values to re-render.\n\nCompatibility\n------------------------------------------------------------------------------\n\n* Ember.js v3.24 or above\n* Ember CLI v3.24 or above\n* Node.js v12 or above\n\n\nInstallation\n------------------------------------------------------------------------------\n\n```\nember install tracked-immutable\n```\n\n\nUsage\n------------------------------------------------------------------------------\n\nImport the `@trackedImmutable` decorator:\n\n```js\nimport { trackedImmutable } from 'tracked-immutable';\n```\n\nAnd use it for updates of immutable data (POJOs, Arrays, rich class instances, or a mix thereof) instead of `@tracked`.\n\n\n\nCredits\n------------------------------------------------------------------------------\n\nThis work is largely inspired by and borrows a lot of code from [tracked-redux](https://github.com/pzuraq/tracked-redux),\nwhich share a lot of the same concerns. So credits to [pzuraq](https://github.com/pzuraq) for his prior work!\n\nContributing\n------------------------------------------------------------------------------\n\nSee the [Contributing](CONTRIBUTING.md) guide for details.\n\n\nLicense\n------------------------------------------------------------------------------\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaliber5%2Ftracked-immutable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaliber5%2Ftracked-immutable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaliber5%2Ftracked-immutable/lists"}