Uniswap / interface

🦄 Open source interfaces for the Uniswap protocol
https://app.uniswap.org
GNU General Public License v3.0
4.95k stars 5.02k forks source link

Crash report: `TypeError: s.flatMap is not a function` #2300

Closed nickobinna closed 3 years ago

nickobinna commented 3 years ago

URL

https://app.uniswap.org/#/swap

swap state

{
  "independentField": "INPUT",
  "typedValue": "",
  "INPUT": {
    "currencyId": null
  },
  "OUTPUT": {
    "currencyId": null
  },
  "recipient": null
}

Error

TypeError: s.flatMap is not a function

Stacktrace

TypeError: s.flatMap is not a function
    at https://app.uniswap.org/static/js/main.aa46409c.chunk.js:1:172187
    at Object.useMemo (https://app.uniswap.org/static/js/3.4087c00c.chunk.js:2:1662803)
    at t.useMemo (https://app.uniswap.org/static/js/3.4087c00c.chunk.js:2:1581043)
    at cd (https://app.uniswap.org/static/js/main.aa46409c.chunk.js:1:172165)
    at Nd (https://app.uniswap.org/static/js/main.aa46409c.chunk.js:1:178877)
    at Bd.E.maxHops (https://app.uniswap.org/static/js/main.aa46409c.chunk.js:1:181004)
    at Bd (https://app.uniswap.org/static/js/main.aa46409c.chunk.js:1:181398)
    at rA (https://app.uniswap.org/static/js/main.aa46409c.chunk.js:1:664905)
    at no (https://app.uniswap.org/static/js/3.4087c00c.chunk.js:2:1656838)
    at Vu (https://app.uniswap.org/static/js/3.4087c00c.chunk.js:2:1709296)

Device data

{
  "ua": "Mozilla/5.0 (Linux; Android 7.0; Infinix X559C Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/64.0.3282.137 Mobile Safari/537.36",
  "browser": {
    "name": "Chrome WebView",
    "version": "64.0.3282.137",
    "major": "64"
  },
  "engine": {
    "name": "Blink",
    "version": "64.0.3282.137"
  },
  "os": {
    "name": "Android",
    "version": "7.0"
  },
  "device": {
    "model": "Infinix X559C",
    "type": "mobile"
  },
  "cpu": {}
}
NoahZinsmeister commented 3 years ago

thanks for the report @nickobinna , we recently merged some code that requires native support for flatMap, unfortunately the only fix for now is to use a more modern OS/browser. cc @zzmp

willhennessy commented 3 years ago

what is the cutoff line for browser version? what % of active browsers don't support this function?

MicahZoltu commented 3 years ago

92.8% https://caniuse.com/array-flat

Keep in mind this is absolute. The demographic that uses Uniswap is very likely ahead of the curve ,n browser versioning, so my guess is closer to 99% in reality.

zzmp commented 3 years ago

We explicitly target browsers with >2% usage as defined by Can I Use, all of which have support for flatMap (https://caniuse.com/array-flat).

@nickobinna @eizi12 are you able to update your browsers? This shouldn't be hard to polyfill, but it would increase the app size.