From fae6d5db997f2b23254348e21408dddd5147d560 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 18 Apr 2018 22:21:37 -0700 Subject: [PATCH 1/5] rfc text --- text/0000-ember-data-filter-deprecation.md | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 text/0000-ember-data-filter-deprecation.md diff --git a/text/0000-ember-data-filter-deprecation.md b/text/0000-ember-data-filter-deprecation.md new file mode 100644 index 0000000000..2a0d601d03 --- /dev/null +++ b/text/0000-ember-data-filter-deprecation.md @@ -0,0 +1,66 @@ +- Start Date: (fill me in with today's date, YYYY-MM-DD) +- RFC PR: (leave this empty) +- Ember Issue: (leave this empty) + +# Ember Data Filter Deprecation + +## Summary + +Deprecate the `store.filter` API. This API was previously gated +behind a private `ENV` variable that was enabled by the addon +[`ember-data-filter`](https://github.com/ember-data/ember-data-filter/tree/b62c992186c00dce8cc81f1fb0cf5e2e6fee0f6b#ember-data-filter). + +## Motivation + +The `filter` API was a "memory leak by design". [Patterns exist](https://github.com/ember-data/ember-data-filter#recommended-refactor-guide) +with no-worse ergonomics that have better performance and do not incur memory leak penalties. + +While the change in ergonomics for end consumers in minimal, the change to `ember-data` is subtantial. +The code for this feature required significant amounts of confusing internal plumbing to ensure that +filters were rerun every time any form of mutation (update, addition, deletion) occurred to any record. + +In addition to maintenance costs, this plumbing negatively affects the performance of all `RecordArray`s, + and slow any operations that count as mutations (such as pushing new records into the store). + +By removing this feature, we significantly simplify and streamline the core of `Ember Data`. + +## Detailed design + +We will provide 3 new deprecations with links to a [guide on how to refactor](https://github.com/ember-data/ember-data-filter#recommended-refactor-guide). + +**Deprecation: ember-data-filter:filter** + +Deprecate the primary case (`store.filter('posts', filterFn)`). +Instead, users can combine `store.peekAll` with a computed property. + +**Deprecation: ember-data-filter:query-for-filter** + +This deprecation is specific to folks providing a `query` to be requested the +first time a filter is run. To do this better, users can separate their usage +of `filter` from their usage of `query`. + +**Deprecation: ember-data-filter:empty-filter** + +In the case that users were creating a `filter` with no method for filtering by, +a deprecation is printed letting them know that the easiest path forward is to +use `peekAll`, which would return the same record result set. + +## How we teach this + +The `filter` API is rarely, having been discouraged for many years. A simple post + alerting users to it's deprecation should be sufficient. The refactoring guide is + sufficiently simple that teaching folks a better way should not be much of a hurdle. + +## Drawbacks + +Minor churn for folks that did use this API; however, the end result will improve the +performance of apps using filters more so than anyone else. + +## Alternatives + +There's been some talk of an API for local querying; however, said alternative RFC + would only result in deprecating this API as well. + +## Unresolved questions + +None \ No newline at end of file From 7312c3bf8e72a447f4d000d9e678495fb2bd8893 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 18 Apr 2018 22:22:07 -0700 Subject: [PATCH 2/5] add date --- text/0000-ember-data-filter-deprecation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-ember-data-filter-deprecation.md b/text/0000-ember-data-filter-deprecation.md index 2a0d601d03..789ded55ae 100644 --- a/text/0000-ember-data-filter-deprecation.md +++ b/text/0000-ember-data-filter-deprecation.md @@ -1,4 +1,4 @@ -- Start Date: (fill me in with today's date, YYYY-MM-DD) +- Start Date: (fill me in with today's date, 2018-04-18) - RFC PR: (leave this empty) - Ember Issue: (leave this empty) From 662271d42dd618f5f9bad57ab265a48e2e9474cb Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 18 Apr 2018 22:24:05 -0700 Subject: [PATCH 3/5] fix sp --- text/0000-ember-data-filter-deprecation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-ember-data-filter-deprecation.md b/text/0000-ember-data-filter-deprecation.md index 789ded55ae..43359da579 100644 --- a/text/0000-ember-data-filter-deprecation.md +++ b/text/0000-ember-data-filter-deprecation.md @@ -15,7 +15,7 @@ behind a private `ENV` variable that was enabled by the addon The `filter` API was a "memory leak by design". [Patterns exist](https://github.com/ember-data/ember-data-filter#recommended-refactor-guide) with no-worse ergonomics that have better performance and do not incur memory leak penalties. -While the change in ergonomics for end consumers in minimal, the change to `ember-data` is subtantial. +While the change in ergonomics for end consumers in minimal, the change to `ember-data` is substantial. The code for this feature required significant amounts of confusing internal plumbing to ensure that filters were rerun every time any form of mutation (update, addition, deletion) occurred to any record. From 49316233ecb4f051b25970dbe12650d7d22f7fe8 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 18 Apr 2018 22:30:53 -0700 Subject: [PATCH 4/5] fix word --- text/0000-ember-data-filter-deprecation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-ember-data-filter-deprecation.md b/text/0000-ember-data-filter-deprecation.md index 43359da579..8902db629b 100644 --- a/text/0000-ember-data-filter-deprecation.md +++ b/text/0000-ember-data-filter-deprecation.md @@ -47,7 +47,7 @@ use `peekAll`, which would return the same record result set. ## How we teach this -The `filter` API is rarely, having been discouraged for many years. A simple post +The `filter` API is rarely used, having been discouraged for many years. A simple post alerting users to it's deprecation should be sufficient. The refactoring guide is sufficiently simple that teaching folks a better way should not be much of a hurdle. From 6c0d8f3b734b1221409339b19738feb69d63d160 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 18 Apr 2018 23:50:12 -0700 Subject: [PATCH 5/5] add deprecation target --- text/0000-ember-data-filter-deprecation.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/text/0000-ember-data-filter-deprecation.md b/text/0000-ember-data-filter-deprecation.md index 8902db629b..5e1b299f40 100644 --- a/text/0000-ember-data-filter-deprecation.md +++ b/text/0000-ember-data-filter-deprecation.md @@ -27,6 +27,8 @@ By removing this feature, we significantly simplify and streamline the core of ` ## Detailed design We will provide 3 new deprecations with links to a [guide on how to refactor](https://github.com/ember-data/ember-data-filter#recommended-refactor-guide). +These deprecations will target `3.5`, meaning that the `ember-data-filter` addon will continue to +work and be supported through the release of ember-data `3.4`. **Deprecation: ember-data-filter:filter**