re-base icon indicating copy to clipboard operation
re-base copied to clipboard

Use of Map and WeakMap

Open oscar-b opened this issue 8 years ago • 6 comments

Is the use of Map and WeakMap necessary? I recently added error tracking to our site and found out that old clients barf on these requirements. The alternative is of course to polyfill, but that should probably be documented.

oscar-b avatar Oct 26 '16 10:10 oscar-b

@oscar-b I don't think Map is necessary for keeping track of listeners and refs. Could use a different approach. The WeakMap is used because React does not have a unique identifier for each component and syncState needs that. Which clients are having issues?

qwales1 avatar Oct 26 '16 15:10 qwales1

@qwales1 Older versions of Chrome (v34) used in Samsung phones from 2014 branded as Samsung Browser.

oscar-b avatar Oct 26 '16 15:10 oscar-b

@oscar-b does the error reporting tell you what specifically its blowing up on? Is it Symbol?

qwales1 avatar Oct 26 '16 17:10 qwales1

ReferenceError
Map is not defined

I guess it's: new WeakMap? Or what do you mean?

oscar-b avatar Oct 26 '16 19:10 oscar-b

@oscar-b Yes sorry that is what I was asking. Could add es6-map and es6-weak-map ponyfills as dependencies. They do not mess with the global scope.

qwales1 avatar Oct 26 '16 20:10 qwales1

I would either refactor to use regular object/array or add documentation about compatibility and use of something like polyfill.io.

oscar-b avatar Oct 27 '16 16:10 oscar-b