{"action":"created","issue":{"url":"https://api.github.com/repos/tgecho/react-prosemirror/issues/10","labels_url":"https://api.github.com/repos/tgecho/react-prosemirror/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/tgecho/react-prosemirror/issues/10/comments","events_url":"https://api.github.com/repos/tgecho/react-prosemirror/issues/10/events","html_url":"https://github.com/tgecho/react-prosemirror/issues/10","id":129777299,"number":10,"title":"Uncaught Error: Option 'schema' can not be changed","user":{"login":"laszbalo","id":1551034,"avatar_url":"https://avatars.githubusercontent.com/u/1551034?v=3","gravatar_id":"","url":"https://api.github.com/users/laszbalo","html_url":"https://github.com/laszbalo","followers_url":"https://api.github.com/users/laszbalo/followers","following_url":"https://api.github.com/users/laszbalo/following{/other_user}","gists_url":"https://api.github.com/users/laszbalo/gists{/gist_id}","starred_url":"https://api.github.com/users/laszbalo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laszbalo/subscriptions","organizations_url":"https://api.github.com/users/laszbalo/orgs","repos_url":"https://api.github.com/users/laszbalo/repos","events_url":"https://api.github.com/users/laszbalo/events{/privacy}","received_events_url":"https://api.github.com/users/laszbalo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-29T14:14:44Z","updated_at":"2016-01-30T17:00:07Z","closed_at":"2016-01-30T17:00:07Z","body":"If I create a react-prosemirror component instance with a custom schema, then any time the parent component' render method runs, I get the above error.\r\n\r\nJust a side note, inside componentDidUpdate, when previous and current options are compared, the non-primitive values (schema, place, commands and doc [ if it is in some fancy format]) will be never  equal, due to the 'shallow' equality checking, therefore pm.setOption is called unnecessary. I have not dig into this deeper, so not sure how does this affect performance, however it might worth to keep it in mind.\r\n\r\nSo back to the real issue, since I am not changing the schema in the parent component, I just made a dirty hack in componentDidUpdate, and filtered out schema, like this:\r\n\r\n```javascript\r\nObject.keys(current).filter( k => k!=='schema').forEach(...);\r\n```\r\n\r\nHowever if someone wants pass in different schema objects to react-prosemirror, based on some state or props of the parent component, then the inability of changing schema of an existing ProseMirror instance, could be problematic. What do you think?"},"comment":{"url":"https://api.github.com/repos/tgecho/react-prosemirror/issues/comments/177245279","html_url":"https://github.com/tgecho/react-prosemirror/issues/10#issuecomment-177245279","issue_url":"https://api.github.com/repos/tgecho/react-prosemirror/issues/10","id":177245279,"user":{"login":"laszbalo","id":1551034,"avatar_url":"https://avatars.githubusercontent.com/u/1551034?v=3","gravatar_id":"","url":"https://api.github.com/users/laszbalo","html_url":"https://github.com/laszbalo","followers_url":"https://api.github.com/users/laszbalo/followers","following_url":"https://api.github.com/users/laszbalo/following{/other_user}","gists_url":"https://api.github.com/users/laszbalo/gists{/gist_id}","starred_url":"https://api.github.com/users/laszbalo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laszbalo/subscriptions","organizations_url":"https://api.github.com/users/laszbalo/orgs","repos_url":"https://api.github.com/users/laszbalo/repos","events_url":"https://api.github.com/users/laszbalo/events{/privacy}","received_events_url":"https://api.github.com/users/laszbalo/received_events","type":"User","site_admin":false},"created_at":"2016-01-30T17:00:07Z","updated_at":"2016-01-30T17:00:07Z","body":"Good call! At the moment I'm defining my custom schema inside the render function, since I do not need dynamic schema, am just going to move it outside of the component, as you suggested.\r\nThank you!\r\n"}}