tylermcginnis / re-base

:fire: A Relay inspired library for building React.js + Firebase applications. :fire:
2.13k stars 143 forks source link

Use of Map and WeakMap #143

Open oscar-b opened 7 years ago

oscar-b commented 7 years ago

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.

qwales1 commented 7 years ago

@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?

oscar-b commented 7 years ago

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

qwales1 commented 7 years ago

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

oscar-b commented 7 years ago
ReferenceError
Map is not defined

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

qwales1 commented 7 years ago

@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.

oscar-b commented 7 years ago

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