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

"JSON.stringify cannot serialize cyclic structures." when tapping Enter in the More block #316

Closed
hypest opened this issue Dec 4, 2018 · 4 comments
Assignees
Labels
[Type] Bug Something isn't working
Milestone

Comments

@hypest
Copy link
Contributor

hypest commented Dec 4, 2018

There seems to be an issue with tapping an enter at the end of the more block.

The desired behavior is to just create a new (paragraph) block after the more when "Enter" is inputted.

Steps to reproduce:

  1. Open the demo app (android or iOS)
  2. Tap into the "Read more" block. The cursor should be at the end of the "Read more"
  3. Tap "enter" on the virtual keyboard.
  4. 💥
JSON.stringify cannot serialize cyclic structures.
serializeAttributes
    serializer.js:181:24
getCommentDelimitedContent
    serializer.js:233:23
serializeBlock
    serializer.js:274:38
serialize
    serializer.js:286:33
<unknown>
    selectors.js:1684:29
callSelector
    rememo.js:249:24
<unknown>
    namespace-store.js:106:60
<unknown>
    AppContainer.js:139:42
getNextMergeProps
    index.js:42:21
onStoreChange
    index.js:122:45
<unknown>
    registry.js:49:45
globalListener
    registry.js:49:21
<unknown>
    namespace-store.js:57:12
dispatch
    createStore.js:186:14
<unknown>
    promise-middleware.js:20:14
<unknown>
    resolvers-cache-middleware.js:33:7
<unknown>
    refx.js:26:20
<unknown>
    namespace-store.js:118:72
proxyDispatch
    index.js:42:4
onChange
    AppContainer.js:54:33
setAttributes
    block-holder.js:58:26
onChange
    edit.native.js:32:47
_onChange
    TextInput.js:1119:47
invokeGuardedCallbackImpl
    ReactNativeRenderer-dev.js:93:15
invokeGuardedCallback
    ReactNativeRenderer-dev.js:318:36
invokeGuardedCallbackAndCatchFirstError
    ReactNativeRenderer-dev.js:342:30
executeDispatch
    ReactNativeRenderer-dev.js:715:42
executeDispatchesInOrder
    ReactNativeRenderer-dev.js:737:20
executeDispatchesAndRelease
    ReactNativeRenderer-dev.js:894:29
forEachAccumulated
    ReactNativeRenderer-dev.js:876:12
runEventsInBatch
    ReactNativeRenderer-dev.js:1050:21
runExtractedEventsInBatch
    ReactNativeRenderer-dev.js:1072:19
<unknown>
    ReactNativeRenderer-dev.js:2711:6
batchedUpdates$1
    ReactNativeRenderer-dev.js:17075:14
batchedUpdates
    ReactNativeRenderer-dev.js:2614:31
_receiveRootNodeIDEvent
    ReactNativeRenderer-dev.js:2709:17
receiveEvent
    ReactNativeRenderer-dev.js:2729:26
__callFunction
    MessageQueue.js:349:47
<unknown>
    MessageQueue.js:106:26
__guard
    MessageQueue.js:297:10
callFunctionReturnFlushedQueue
    MessageQueue.js:105:17
@hypest hypest added the [Type] Bug Something isn't working label Dec 4, 2018
@hypest hypest added this to the Alpha milestone Dec 4, 2018
@daniloercoli
Copy link
Contributor

I can replicate the issue by inserting any character in the More block. At any position in the text.

  • Open the demo app (tested on Android only)
  • Tap into the "Read more" block. Place the caret at the middle of "Read more"
  • Tap any character on the virtual keyboard.
  • Booom

@daniloercoli
Copy link
Contributor

daniloercoli commented Dec 4, 2018

In order to see what was received from the underlying layers, I changed the onChange prop in More block by doing this onChange={ ( newValue ) => console.log( newValue ) } and noticed that the app is not crashing anymore, you can write any characters in the More block, but:

  • The log is never printed in AS console
  • If you try to move the caret to another block, it will be brought back into the More block
  • The app becomes laggy, and it crashes after a while with no info logged in console

I then thought it was a problem in the JSON.stringify() method that is called over newValue to print it in console, and than changed it to onChange={ ( ) => console.log( 'Hello!' ) }, to see if i was able to print something in console onChange but the problem is the same of above. Nothing is printed and the app crashes after a while.

Edit:
After more investigation it seems the correct value is returned from TextInput->PlainText till to the More block. Then the problem happens when we update with setAttributes, even though the correct value is passed. cc @Tug

@daniloercoli
Copy link
Contributor

daniloercoli commented Dec 5, 2018

I also noticed that the Enter.key handling/detection is not implemented in the More Block.
Actually I don't think we've the Enter.key detection in place on PlainText based blocks. We should probably open a new ticket for it. Assigning it to beta? cc @hypest

@hypest
Copy link
Contributor Author

hypest commented Dec 5, 2018

We should probably open a new ticket for it. Assigning it to beta?

Let's indeed create a new ticket but let's add it to the Alpha. If we can't make it we can bump it to the Beta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants