Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] fix detect usage for native class polymorphism #6767

Merged
merged 2 commits into from
Nov 19, 2019

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Nov 19, 2019

resolves #6728
Ports the test from #6727 and adds a fix

@runspired runspired added 🏷️ bug This PR primarily fixes a reported issue Octane 🎯 beta PR should be backported to beta 🎯 release PR should be backported to release labels Nov 19, 2019
@github-actions
Copy link

Asset Size Report for 294d399

EmberData has not changed in size

If any packages had changed sizes they would be listed here.

Changeset



Full Asset Analysis

Asset Size Report
=================


Library: EmberData
┌────────────┬─────────────┐
│  (index)   │   Values    │
├────────────┼─────────────┤
│   bytes    │ '160.05 KB' │
│ compressed │ '34.17 KB'  │
│  packages  │      9      │
│  modules   │     47      │
└────────────┴─────────────┘

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '71.67 KB' │
│  compressed  │ '15.30 KB' │
│ % Of Library │   '44.8'   │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                    | 70.75 KB  | 15.11 KB   | 98.7          | 44.2
	@ember-data/store/index                       | 936.00 B  | 199.83 B   | 1.3           | 0.6

Package: @ember-data/record-data
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '22.94 KB' │
│  compressed  │ '4.90 KB'  │
│ % Of Library │   '14.3'   │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/record-data/-private              | 22.94 KB  | 4.90 KB    | 100.0         | 14.3

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '19.30 KB' │
│  compressed  │ '4.12 KB'  │
│ % Of Library │   '12.1'   │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                   | 7.10 KB   | 1.52 KB    | 36.8          | 4.4
	@ember-data/serializer/-private               | 5.36 KB   | 1.14 KB    | 27.8          | 3.3
	@ember-data/serializer/json-api               | 3.71 KB   | 810.44 B   | 19.2          | 2.3
	@ember-data/serializer/rest                   | 2.68 KB   | 585.62 B   | 13.9          | 1.7
	@ember-data/serializer/index                  | 243.00 B  | 51.88 B    | 1.2           | 0.1
	@ember-data/serializer/transform              | 215.00 B  | 45.90 B    | 1.1           | 0.1

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '14.57 KB' │
│  compressed  │ '3.11 KB'  │
│ % Of Library │   '9.1'    │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                      | 7.65 KB   | 1.63 KB    | 52.5          | 4.8
	@ember-data/adapter/-private                  | 3.50 KB   | 765.18 B   | 24.0          | 2.2
	@ember-data/adapter/error                     | 1.91 KB   | 418.24 B   | 13.1          | 1.2
	@ember-data/adapter/json-api                  | 830.00 B  | 177.20 B   | 5.6           | 0.5
	@ember-data/adapter/index                     | 719.00 B  | 153.50 B   | 4.8           | 0.4

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '10.22 KB' │
│  compressed  │ '2.18 KB'  │
│ % Of Library │   '6.4'    │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                    | 9.75 KB   | 2.08 KB    | 95.4          | 6.1
	@ember-data/model/index                       | 486.00 B  | 103.76 B   | 4.6           | 0.3

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '9.72 KB' │
│  compressed  │ '2.08 KB' │
│ % Of Library │   '6.1'   │
└──────────────┴───────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                              | 2.42 KB   | 529.26 B   | 24.9          | 1.5
	ember-data/-private                           | 1.98 KB   | 433.19 B   | 20.4          | 1.2
	ember-data/adapters/errors                    | 1.19 KB   | 259.82 B   | 12.2          | 0.7
	ember-data/setup-container                    | 503.00 B  | 107.39 B   | 5.1           | 0.3
	ember-data/store                              | 406.00 B  | 86.68 B    | 4.1           | 0.2
	ember-data/relationships                      | 318.00 B  | 67.89 B    | 3.2           | 0.2
	ember-data/serializers/embedded-records-mixin | 274.00 B  | 58.49 B    | 2.8           | 0.2
	ember-data/serializers/json-api               | 251.00 B  | 53.58 B    | 2.5           | 0.2
	ember-data/adapters/json-api                  | 245.00 B  | 52.30 B    | 2.5           | 0.1
	ember-data/serializers/json                   | 243.00 B  | 51.88 B    | 2.4           | 0.1
	ember-data/serializers/rest                   | 243.00 B  | 51.88 B    | 2.4           | 0.1
	ember-data/transform                          | 241.00 B  | 51.45 B    | 2.4           | 0.1
	ember-data/adapters/rest                      | 237.00 B  | 50.59 B    | 2.4           | 0.1
	ember-data/serializer                         | 232.00 B  | 49.53 B    | 2.3           | 0.1
	ember-data/adapter                            | 226.00 B  | 48.25 B    | 2.3           | 0.1
	ember-data/model                              | 222.00 B  | 47.39 B    | 2.2           | 0.1
	ember-data/attr                               | 218.00 B  | 46.54 B    | 2.2           | 0.1
	ember-data/initialize-store-service           | 207.00 B  | 44.19 B    | 2.1           | 0.1
	ember-data/version                            | 162.00 B  | 34.58 B    | 1.6           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '7.90 KB' │
│  compressed  │ '1.69 KB' │
│ % Of Library │   '4.9'   │
└──────────────┴───────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector          | 2.75 KB   | 601.42 B   | 34.8          | 1.7
	ember-inflector/lib/system/inflections        | 1.57 KB   | 343.73 B   | 19.9          | 1.0
	ember-inflector/index                         | 1.12 KB   | 245.09 B   | 14.2          | 0.7
	ember-inflector/lib/ext/string                | 783.00 B  | 167.17 B   | 9.7           | 0.5
	ember-inflector/lib/system                    | 452.00 B  | 96.50 B    | 5.6           | 0.3
	ember-inflector/lib/system/string             | 351.00 B  | 74.93 B    | 4.3           | 0.2
	ember-inflector/lib/helpers/pluralize         | 348.00 B  | 74.29 B    | 4.3           | 0.2
	ember-inflector/lib/utils/make-helper         | 308.00 B  | 65.75 B    | 3.8           | 0.2
	ember-inflector/lib/helpers/singularize       | 271.00 B  | 57.85 B    | 3.4           | 0.2

Package: @ember-data/debug
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '2.68 KB'  │
│  compressed  │ '585.62 B' │
│ % Of Library │   '1.7'    │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/debug/index                       | 2.19 KB   | 479.09 B   | 81.8          | 1.4
	@ember-data/debug/setup                       | 499.00 B  | 106.53 B   | 18.2          | 0.3

Package: @ember/ordered-set
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '1.05 KB'  │
│  compressed  │ '230.15 B' │
│ % Of Library │   '0.7'    │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember/ordered-set/index                      | 1.05 KB   | 230.15 B   | 100.0         | 0.7

Copy link

@pzuraq pzuraq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense given the way polymorphism works currently. I'm assuming this means that you can't inherit from a class that has the polymorphic mixin, you have to mixin it in directly (or as close as you can with native classes).

This would have the side effect that you can inherit from a polymorphic class, if you are using classic class syntax:

const Foo = Model.extend(MyMixin);

// This will pass the check
const Bar = Foo.extend(); 

Does that make sense?

@runspired
Copy link
Contributor Author

@pzuraq it does. If we were failing to detect mixins from things being extended before then this is an even better bugfix :) Hopefully we can get away from class based polymorphism soon :D

@runspired runspired merged commit 3edccf1 into master Nov 19, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix/mixin-polymorphism branch November 19, 2019 20:32
@igorT igorT removed the 🎯 beta PR should be backported to beta label Dec 14, 2019
igorT pushed a commit that referenced this pull request Dec 14, 2019
* polymorphic relations and native classes mixins bug test

* [BUGFIX] fix detect usage for native class polymorphism
@igorT igorT removed the 🎯 release PR should be backported to release label Dec 14, 2019
igorT pushed a commit that referenced this pull request Dec 14, 2019
* polymorphic relations and native classes mixins bug test

* [BUGFIX] fix detect usage for native class polymorphism
igorT pushed a commit that referenced this pull request Dec 18, 2019
* polymorphic relations and native classes mixins bug test

* [BUGFIX] fix detect usage for native class polymorphism
igorT pushed a commit that referenced this pull request Dec 18, 2019
* polymorphic relations and native classes mixins bug test

* [BUGFIX] fix detect usage for native class polymorphism
mmun pushed a commit to Addepar/ember-data that referenced this pull request Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bug This PR primarily fixes a reported issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Polymorphic relationships and native classes
4 participants