Empty block not being added to blocks[]
See original GitHub issueWhen you hit Enter, a new and empty paragraph block is added on page. However, this does not get added to the blocks[]
array.
The problem with this is that the getCurrentBlockIndex()
API method queries elements from the DOM, so it’s now de-synced from the actual data - you can’t use it as a source of truth anymore. In a Vue.js context, where data is your source of truth, this is problematic.
In my case, this happens:
- I have a paragraph block on page - this would be at index 0 if queried for
- hit Enter, new paragraph block created on page, at index 1 (but not in data)
- insert a new block at the end with the API (triggered with click on a button). This block is at index 2 when queried for, but at index 1 in my
blocks[]
data, because nothing was added at step 2…
Any ideas on how to overcome this?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Why aren't more empty blocks mined? - Bitcoin Stack Exchange
There is some kind of relationship between empty blocks and difficulty increase/decrease that I have not been able to formulate properly.
Read more >Adding blocks – WordPress.org Forums
Click on the Block Inserter + icon to the right of an empty block. This will open a modal window with a list...
Read more >Database, not including empty blocks, is substantially larger ...
Database, not including empty blocks, is substantially larger than the actual data size at a point in time. Many areas have database blocks...
Read more >no-empty-block - Dart Code Metrics
Disallows empty blocks except catch clause block. Blocks with a todo comment inside are not considered empty. Empty blocks are often indicators of...
Read more >Menu block renders when tree is empty as of 8.x-1.8 [regression]
Removing the access check in #3216265: Module causes double rendering of blocks just to check access now means that empty menu blocks are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the solution. If someone wants to a React Overwrite. I paste it here, if maybe someone looks for that.
Thanks @gohabereg, but I don’t want to have to maintain a fork - all I’d want is for the
getCurrentBlockIndex()
to work reliably 😃