{"action":"created","issue":{"url":"https://api.github.com/repos/WordPress/gutenberg/issues/8783","repository_url":"https://api.github.com/repos/WordPress/gutenberg","labels_url":"https://api.github.com/repos/WordPress/gutenberg/issues/8783/labels{/name}","comments_url":"https://api.github.com/repos/WordPress/gutenberg/issues/8783/comments","events_url":"https://api.github.com/repos/WordPress/gutenberg/issues/8783/events","html_url":"https://github.com/WordPress/gutenberg/issues/8783","id":349198741,"node_id":"MDU6SXNzdWUzNDkxOTg3NDE=","number":8783,"title":"InnerBlocks component saves only first nested block","user":{"login":"p4veI","id":5863272,"node_id":"MDQ6VXNlcjU4NjMyNzI=","avatar_url":"https://avatars1.githubusercontent.com/u/5863272?v=4","gravatar_id":"","url":"https://api.github.com/users/p4veI","html_url":"https://github.com/p4veI","followers_url":"https://api.github.com/users/p4veI/followers","following_url":"https://api.github.com/users/p4veI/following{/other_user}","gists_url":"https://api.github.com/users/p4veI/gists{/gist_id}","starred_url":"https://api.github.com/users/p4veI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p4veI/subscriptions","organizations_url":"https://api.github.com/users/p4veI/orgs","repos_url":"https://api.github.com/users/p4veI/repos","events_url":"https://api.github.com/users/p4veI/events{/privacy}","received_events_url":"https://api.github.com/users/p4veI/received_events","type":"User","site_admin":false},"labels":[{"id":816933178,"node_id":"MDU6TGFiZWw4MTY5MzMxNzg=","url":"https://api.github.com/repos/WordPress/gutenberg/labels/Needs%20Testing","name":"Needs Testing","color":"67dff7","default":false},{"id":896884785,"node_id":"MDU6TGFiZWw4OTY4ODQ3ODU=","url":"https://api.github.com/repos/WordPress/gutenberg/labels/[Component]%20Nested%20/%20Inner%20Blocks","name":"[Component] Nested / Inner Blocks","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-09T16:21:41Z","updated_at":"2018-09-13T23:20:09Z","closed_at":null,"author_association":"NONE","body":"## Issue Overview\r\nHello, I've come across a weird issue with the InnerBlocks component on Gutenber, tried to create a custom tabs block with the use of InnerBlocks, and I can make use of the editor so it creates nested \"TAB\" blocks within my \"TABS\" block. However if I add multiple nested elements (e.g. 2+), the editor saves the blocks on publish/update in post and can display my output on the frontend.\r\n\r\nIf I refresh the editor I only see the first nested block and the others are scratched. Since the usage of InnerBlocks and the syntax is quite limited, I'm having hard time figuring out where the problem resides.\r\n\r\n## Code Examples\r\nTabs.js edit & save functions\r\n```\r\n//no arguments set in this block, not necessary at this point I think\r\nedit(props) {\r\n    return(\r\n\t\t\t<div className={props.className}>\r\n\t\t\t\t<h4>Tabs</h4>\r\n\t\t\t\t<div className={'Tabs'}>\r\n\t\t\t\t\t<div className={'Tabs-wrap'}>\r\n\t\t\t\t\t\t<InnerBlocks template={[['gity/tab', {}]]} layout={{}} />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t)\r\n\t}, \r\nsave(props) {\r\n\t\treturn(\r\n\t\t\t<div className={'Tabs'}>\r\n\t\t\t\t<div className={'Tabs-nav'}></div>\r\n\t\t\t\t<div className={'Tabs-wrap'}>\r\n\t\t\t\t\t<InnerBlocks.Content />\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t)\r\n\t}\r\n```\r\ntab.js\r\n```\r\nregisterBlockType( 'gity/tab', {\r\n...\r\nparent: ['gity/tabs'],\r\n\tattributes: {\r\n\t\ttitle: {\r\n\t\t\ttype: 'string',\r\n\t\t\tsource: 'text',\r\n\t\t\tselector: '.Tabs-title'\r\n\t\t},\r\n\t\tbody: {\r\n\t\t\ttype: 'array',\r\n\t\t\tsource: 'children',\r\n\t\t\tselector: '.Tabs-body'\r\n\t\t}\r\n\t},\r\n\tsupports: {\r\n\t\t...\r\n\t},\r\n\tedit(props) {\r\n\t\tlet content = props.attributes\r\n    return(\r\n\t\t\t<div className={props.className}>\r\n\t\t\t\t<strong>\r\n\t\t\t\t\t<PlainText\r\n\t\t\t\t\t\tonChange={ content => props.setAttributes({title: content}) }\r\n\t\t\t\t\t\tvalue={ content.title }\r\n\t\t\t\t\t\tplaceholder=\"Titulek záložky\"\r\n\t\t\t\t\t\tclassName=\"Tabs-title\"\r\n\t\t\t\t\t\tformattingControls={ [] }\r\n\t\t\t\t\t\tisSelected={props.isSelected}\r\n\t\t\t\t\t/>\r\n\t\t\t\t</strong>\r\n\t\t\t\t<RichText\r\n\t\t\t\t\tonChange={ content => props.setAttributes({body: content}) }\r\n\t\t\t\t\tvalue={ content.body }\r\n\t\t\t\t\tmultiline=\"p\"\r\n\t\t\t\t\tplaceholder=\"Obsah záložky\"\r\n\t\t\t\t\tclassName=\"Tabs-body\"\r\n\t\t\t\t\tisSelected={props.isSelected}\r\n\t\t\t\t/>\r\n\t\t\t</div>\r\n\t\t)\r\n\t},\r\n\tsave(props) {\r\n\t\tlet content = props.attributes\r\n\t\treturn(\r\n\t\t\t<div className={props.className}>\r\n\t\t\t\t<span className={'Tabs-title'}>{content.title}</span>\r\n\t\t\t\t<div className={'Tabs-body'}>{content.body}</div>\r\n\t\t\t</div>\r\n\t\t)\r\n\t}\r\n```\r\n\r\n## Steps to Reproduce (for bugs)\r\n1. Create a new parent block tabs.js\r\n2. Create a child block tab.js\r\n3. Make sure values are being saved\r\n4. Add multiple nested elements in editor\r\n5. Update post & refresh\r\n6. Only the top nested element is now available for edit...\r\n7. View post\r\n8. Values from other nested elements appear to be saved but can't be edited in editor\r\n9. update post & view post\r\n10. other nested values are missing...\r\n## Screenshots / Video\r\n<!-- Visual records are oxygen for others to understand what you are sharing -->\r\n### Step 1\r\n![screenshot from 2018-08-09 18-08-07](https://user-images.githubusercontent.com/5863272/43911387-a00fc2a8-9bff-11e8-9927-e9c04a5e3a3b.png)\r\n\r\n### Step 2\r\n![screenshot from 2018-08-09 18-08-34](https://user-images.githubusercontent.com/5863272/43911386-9fee439e-9bff-11e8-8194-2be6de63fbc7.png)\r\n\r\n### Step 3\r\n![screenshot from 2018-08-09 18-08-52](https://user-images.githubusercontent.com/5863272/43911384-9fcc5bbc-9bff-11e8-9884-7cca676233d7.png)\r\n\r\n### Step 4\r\n![screenshot from 2018-08-09 18-09-46](https://user-images.githubusercontent.com/5863272/43911383-9fad3872-9bff-11e8-9c00-147bf1ceaa6b.png)\r\n\r\n### Step 5\r\n![screenshot from 2018-08-09 18-10-05](https://user-images.githubusercontent.com/5863272/43911380-9f8b5a5e-9bff-11e8-8a91-5838999bf8b7.png)\r\n\r\n### Step 6\r\n![screenshot from 2018-08-09 18-10-13](https://user-images.githubusercontent.com/5863272/43911379-9f667f22-9bff-11e8-8250-dc42b45bb3d4.png)\r\n\r\n### Step 7\r\n![screenshot from 2018-08-09 18-10-55](https://user-images.githubusercontent.com/5863272/43911377-9ea81370-9bff-11e8-9068-41e918ddcb2a.png)\r\n\r\nAny suggestions? Is this normal behaviour?\r\n"},"comment":{"url":"https://api.github.com/repos/WordPress/gutenberg/issues/comments/421182403","html_url":"https://github.com/WordPress/gutenberg/issues/8783#issuecomment-421182403","issue_url":"https://api.github.com/repos/WordPress/gutenberg/issues/8783","id":421182403,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTE4MjQwMw==","user":{"login":"haszari","id":4167300,"node_id":"MDQ6VXNlcjQxNjczMDA=","avatar_url":"https://avatars1.githubusercontent.com/u/4167300?v=4","gravatar_id":"","url":"https://api.github.com/users/haszari","html_url":"https://github.com/haszari","followers_url":"https://api.github.com/users/haszari/followers","following_url":"https://api.github.com/users/haszari/following{/other_user}","gists_url":"https://api.github.com/users/haszari/gists{/gist_id}","starred_url":"https://api.github.com/users/haszari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haszari/subscriptions","organizations_url":"https://api.github.com/users/haszari/orgs","repos_url":"https://api.github.com/users/haszari/repos","events_url":"https://api.github.com/users/haszari/events{/privacy}","received_events_url":"https://api.github.com/users/haszari/received_events","type":"User","site_admin":false},"created_at":"2018-09-13T23:20:09Z","updated_at":"2018-09-13T23:20:09Z","author_association":"NONE","body":"I'm seeing this issue too – if I set a `template` on an `InnerBlocks`, any content that doesn't match the template gets cleared out on editor reload. I think this is happening in [`componentDidMount`](https://github.com/WordPress/gutenberg/blob/2d1e3e055c31a2df03aec83ce940a5dfe17447c6/packages/editor/src/components/inner-blocks/index.js#L32).\r\n\r\nThis doesn't feel like intended behaviour to me. I understand templates to be a default initial state - that's the way we're using them. The [`templateLock`](https://github.com/WordPress/gutenberg/tree/2d1e3e055c31a2df03aec83ce940a5dfe17447c6/packages/editor/src/components/inner-blocks#templatelock) option suggests that any other blocks or changes should be respected and saved. \r\n\r\nMy thinking is that if the \"reset to match the template\" behaviour is needed, it should be optional, or perhaps on-demand. Maybe this option could be provided through `templateLock` parameter?"}}
{"actor":{"display_login":"haszari"}}