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

Make JsBackedMap.values MSIE 11 compatible #273

Merged
merged 1 commit into from
Aug 7, 2020

Conversation

aaronlademann-wf
Copy link
Collaborator

@aaronlademann-wf aaronlademann-wf commented Aug 7, 2020

Object.values is not supported in MSIE 11. We still have consumers that need to support the browser, so our JsBackedMap.values implementation needs to support it.

Currently, if you access the values getter (as we do within forwardRef), MSIE 11 will choke. This fixes that.

@greglittlefield-wf

@aaronlademann-wf aaronlademann-wf force-pushed the 5.5.0/polyfill-jsmap-values-for-ie11 branch from 2ba955e to c66b92a Compare August 7, 2020 19:54
Copy link
Collaborator

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

+10

@@ -38,7 +38,8 @@ class JsBackedMap extends MapBase<dynamic, dynamic> {

// Private helpers with narrower typing than we want to expose, for use in other methods
List<dynamic> get _keys => _Object.keys(jsObject);
List<dynamic> get _values => _Object.values(jsObject);
// Use keys to access the value instead oof `Object.values` since MSIE 11 doesn't support it
List<dynamic> get _values => _keys.map((key) => this[key]).toList();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd like to see us eventually polyfill Object.values on the JS side so that this can be potentially more optimized in browsers that support it, but this is totally fine for now

@greglittlefield-wf greglittlefield-wf merged commit ee19eb2 into 5.5.0-wip Aug 7, 2020
@greglittlefield-wf greglittlefield-wf deleted the 5.5.0/polyfill-jsmap-values-for-ie11 branch February 16, 2022 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants