{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/6622","repository_url":"https://api.github.com/repos/facebook/react","labels_url":"https://api.github.com/repos/facebook/react/issues/6622/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/6622/comments","events_url":"https://api.github.com/repos/facebook/react/issues/6622/events","html_url":"https://github.com/facebook/react/issues/6622","id":151186895,"number":6622,"title":"Have React ignore a specific DOM element","user":{"login":"nickdima","id":614468,"avatar_url":"https://avatars.githubusercontent.com/u/614468?v=3","gravatar_id":"","url":"https://api.github.com/users/nickdima","html_url":"https://github.com/nickdima","followers_url":"https://api.github.com/users/nickdima/followers","following_url":"https://api.github.com/users/nickdima/following{/other_user}","gists_url":"https://api.github.com/users/nickdima/gists{/gist_id}","starred_url":"https://api.github.com/users/nickdima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickdima/subscriptions","organizations_url":"https://api.github.com/users/nickdima/orgs","repos_url":"https://api.github.com/users/nickdima/repos","events_url":"https://api.github.com/users/nickdima/events{/privacy}","received_events_url":"https://api.github.com/users/nickdima/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-26T17:00:11Z","updated_at":"2016-04-26T18:06:33Z","closed_at":null,"body":"As per my chat [here](https://twitter.com/nickdima/status/723904527083147264) with @gaearon I'm filing an issue to discuss this further.\r\n\r\nI would like to avoid a specific element that I rendered on the server from beeing further updated by react once it reaches the client.\r\nOne specific use case is rendering ad server tags that are kind of a pain in the ars, using things like `document.write`, etc. I render them using `dangerouslySetInnerHTML` but sometimes when React is doing the reconciliation client side they get re-render so they stop executing. Now I managed to track down some of these cases by fixing render differences between server and client which would trigger DOM patching but it still seems to happen.\r\nAny advice?\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/214831697","html_url":"https://github.com/facebook/react/issues/6622#issuecomment-214831697","issue_url":"https://api.github.com/repos/facebook/react/issues/6622","id":214831697,"user":{"login":"jimfb","id":9595985,"avatar_url":"https://avatars.githubusercontent.com/u/9595985?v=3","gravatar_id":"","url":"https://api.github.com/users/jimfb","html_url":"https://github.com/jimfb","followers_url":"https://api.github.com/users/jimfb/followers","following_url":"https://api.github.com/users/jimfb/following{/other_user}","gists_url":"https://api.github.com/users/jimfb/gists{/gist_id}","starred_url":"https://api.github.com/users/jimfb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimfb/subscriptions","organizations_url":"https://api.github.com/users/jimfb/orgs","repos_url":"https://api.github.com/users/jimfb/repos","events_url":"https://api.github.com/users/jimfb/events{/privacy}","received_events_url":"https://api.github.com/users/jimfb/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T18:06:33Z","updated_at":"2016-04-26T18:06:33Z","body":"@nickdima I would recommend figuring out why the DOM differs.  You should be fixing those errors anyway, and that's the \"theoretically correct\" solution.\r\n\r\nWhen validation fails, there is the question of \"what todo\".  React needs to be able to update the DOM (that's its job, after all), but if there are arbitrarily wrong nodes in the render tree, it's not obvious how updates should occur.  In such situations, React just blows away the entire render tree and starts from scratch, thus ensuring that everything matches.  This has the side effect of clearing any DOM state (for better or for worse).\r\n\r\nI think Sebastian likes the current behavior (always blow away the entire tree if validation fails) because it avoids \"interaction bugs\".  Suppose a user clicks the \"delete\" button for the third document in a list.  When the element was rendered with SSR, the document had the title \"old todo list\", but when rendered on the client side the third item is a document entitled \"important financial documents\".  React notices that only the element title changes, so it applies the update and then fires the click listener for the \"delete\" operation.  Now the user just deleted the wrong document.  Throwing away the entire DOM tree minimizes the likelihood of this happening, because everything (including pending operations/state) is destroyed.\r\n\r\nPersonally, I don't have an opinion.  cc @sebmarkbage, who may have an opinion."}}