logger icon indicating copy to clipboard operation
logger copied to clipboard

SyntaxError: Unexpected token u in JSON at position 0 when using chaining operator in store.map

Open kaguya3222 opened this issue 2 years ago • 0 comments

Versions

  • effector: 22.2.0
  • effector-logger: 0.13.4
  • node: 14.19.1

Reproduction

Codesandbox (react + effector): https://codesandbox.io/s/serene-frog-rvcke7?file=/src/App.js

Steps to reproduce:

  1. Open sandbox repro
  2. Type some player name into input
  3. Click set player name
  4. Open console and you'll see this error: SyntaxError: Unexpected token u in JSON at position 0

What is expected?

Error is not expected because when I'm using createStore and createEvent from 'effector' - there is no error.

Important

I observe this error only when using the chaining operator ?. is store.map. For example, if we change this line: const $playerName = $player.map((player) => player?.name); to const $playerName = $player.map((player) => player ? player.name : null); - there is no error

kaguya3222 avatar Apr 09 '22 18:04 kaguya3222