| {"query_id": "q-en-react-0224e72f53068cfce1eb60f4e6918116817d50f053dcb5f8b5a759638f7bc467", "query": "``` accept acceptCharset accessKey action allowFullScreen allowTransparency alt <del> async autoComplete autoFocus autoPlay cellPadding cellSpacing charSet checked classID className colSpan cols content contentEditable contextMenu controls </del> <ins> async autoComplete autoFocus autoPlay cellPadding cellSpacing charSet challenge checked classID className colSpan cols content contentEditable contextMenu controls </ins> coords crossOrigin data dateTime defer dir disabled download draggable encType form formAction formEncType formMethod formNoValidate formTarget frameBorder <del> headers height hidden high href hrefLang htmlFor httpEquiv icon id label lang list loop low manifest marginHeight marginWidth max maxLength media mediaGroup method min multiple muted name noValidate open optimum pattern placeholder </del> <ins> headers height hidden high href hrefLang htmlFor httpEquiv icon id keyParams keyType label lang list loop low manifest marginHeight marginWidth max maxLength media mediaGroup method min multiple muted name noValidate open optimum pattern placeholder </ins> poster preload radioGroup readOnly rel required role rowSpan rows sandbox scope scoped scrolling seamless selected shape size sizes span spellCheck src srcDoc srcSet start step style tabIndex target title type useMap value width wmode", "positive_passages": [{"docid": "doc-en-react-c106a437ddd3bd1957c6502f10dcab059cffc9005b0db8685ba1254d6e535341", "text": "I'm using tag to generate client certificates and I'm missing challenge and keytype attributes.\nIt would be cool if React gives us the opportunity to use different syntax for attrs and props: And may be: There would be no need to know what tags React supporting.\nThere's more planned to alleviate the issues around unknown elements and properties, but we're not there yet. We have no plans on to use different syntax. Adding the additional attributes here seems totally reasonable.\nWill try to take a stab at this. I assume this is as simple as adding those props to , and then adding tests. Is that correct or am I missing anything significant?\nIt's even easier than that since we don't really have tests for the attributes. But do actually test in a couple browsers that changing values across renders is reflected appropriately (usually the issues is property vs attribute).\nYou're quick, guys. Thanks in advance!\nBy 'across renders' you mean simply triggering a re-render (by changing the value)?\nYea. I usually just make a simple component with a button that toggles state so I can test with multiple values easily.\nGreat. Thx.\nI missed a detail in docs. Although, I don't need it, there's an additional attribute, keyparams, which is required with \"dsa\" and \"ec\" keytypes. See\nHave this working, though I'm not entirely clear if these should be , or . I wasn't able to deduce the meaning of these from the code. Is there someplace I can read up on these?\nThose are used to determine if we do or if we do when updating. means it doesn't matter and browsers should work with either. Currently we use properties in that case but we may switch that in the future. indicate that they must be set & removed as a property or an attribute.\nThanks. That makes sense. Had to use to get it to work properly across Chrome/FF/Safari. Your testing method great as well. Thx for your help", "commid": "react_issue_3961", "tokennum": 430}], "negative_passages": []} | |
| {"query_id": "q-en-react-02695d84dd62ba8e5cc7d7d1498b6382aac82412daaaa94e7b6dce768cee0bd5", "query": "expect(log).toEqual([]); }); <ins> it('should pass previous state to shouldComponentUpdate even with getDerivedStateFromProps', () => { const divRef = React.createRef(); class SimpleComponent extends React.Component { constructor(props) { super(props); this.state = { value: props.value, }; } static getDerivedStateFromProps(nextProps, prevState) { if (nextProps.value === prevState.value) { return null; } return {value: nextProps.value}; } shouldComponentUpdate(nextProps, nextState) { return nextState.value !== this.state.value; } render() { return <div ref={divRef}>value: {this.state.value}</div>; } } const div = document.createElement('div'); ReactDOM.render(<SimpleComponent value=\"initial\" />, div); expect(divRef.current.textContent).toBe('value: initial'); ReactDOM.render(<SimpleComponent value=\"updated\" />, div); expect(divRef.current.textContent).toBe('value: updated'); }); </ins> it('should call getSnapshotBeforeUpdate before mutations are committed', () => { const log = [];", "positive_passages": [{"docid": "doc-en-react-af6422597abfc3705e1e016cf37e5dbfbfdcf0923b24267ad3eb49d20f8d6064", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug What is the current behavior? In , the shallow renderer will set instance state in so the and will be the same in , which is different with the behavior of real rendering. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: given below class component: render with ReactDOM, the will return true since will be the old value : In shallow renderer, the behavior is different: What is the expected behavior? ShallowRenderer should not set the instance state in getDeriveStateFromProps, or in the we have no way to compare it. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? I have tested this in master branch and 16.3, both not work. By the way this problem is related to airbnb/enzyme . If it's recoginzed as a bug I can provide a PR in next several days.", "commid": "react_issue_14607", "tokennum": 285}], "negative_passages": []} | |
| {"query_id": "q-en-react-08051247c7484c21a13b92a0969c97f7789334fc06a140d56ce8f307ea75ed1f", "query": "} } } <del> this._updateStateFromStaticLifecycle(props); </del> // Read state after cWRP in case it calls setState <del> const state = this._newState || oldState; </del> <ins> let state = this._newState || oldState; if (typeof type.getDerivedStateFromProps === 'function') { const partialState = type.getDerivedStateFromProps.call( null, props, state, ); if (partialState != null) { state = Object.assign({}, state, partialState); } } </ins> let shouldUpdate = true; if (this._forcedUpdate) {", "positive_passages": [{"docid": "doc-en-react-af6422597abfc3705e1e016cf37e5dbfbfdcf0923b24267ad3eb49d20f8d6064", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug What is the current behavior? In , the shallow renderer will set instance state in so the and will be the same in , which is different with the behavior of real rendering. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: given below class component: render with ReactDOM, the will return true since will be the old value : In shallow renderer, the behavior is different: What is the expected behavior? ShallowRenderer should not set the instance state in getDeriveStateFromProps, or in the we have no way to compare it. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? I have tested this in master branch and 16.3, both not work. By the way this problem is related to airbnb/enzyme . If it's recoginzed as a bug I can provide a PR in next several days.", "commid": "react_issue_14607", "tokennum": 285}], "negative_passages": []} | |
| {"query_id": "q-en-react-083d62956cf05470274440705503ba0a0734b57f8b4e261f16d6ac1983b31d37", "query": "var React = require('React'); var ReactElement = require('ReactElement'); var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter'); <ins> var ReactCompositeComponent = require('ReactCompositeComponent'); var ReactInstanceHandles = require('ReactInstanceHandles'); </ins> var ReactInstanceMap = require('ReactInstanceMap'); var ReactMount = require('ReactMount'); var ReactUpdates = require('ReactUpdates'); var SyntheticEvent = require('SyntheticEvent'); var assign = require('Object.assign'); <ins> var instantiateReactComponent = require('instantiateReactComponent'); </ins> var topLevelTypes = EventConstants.topLevelTypes;", "positive_passages": [{"docid": "doc-en-react-43bd8c935fcf00bee8061fadc9d53ee4ce08d7674cd1b756a95fad46456d6e25", "text": "We need a way to test the output of a single level React component without resolving it all the way down to the bottom layer (whatever that is). I'm thinking something like this: Basically, this fix needs to go through the entire life-cycle of ReactCompositeComponent. It just needs to bail out whenever it would've continued rendering.\nReopened so that we can track the remaining features (refs etc.)\nWeird, I thought GitHub only closed issues if you used language like \"fixes #NNNN\", not if you simply mentioned the issue at all. Sorry about that.\nThe PR text included \"WIP to \"\nIs the rest (refs support) blocked by or can more work be done now?\nAny reason this doesn't support other than that it's not implemented yet? I was hoping to do something like\nthat's supposed to work. Can you post a minimal repro?\nHow do you do this? does not return an instance.\nIt works if I use so I think could just return that from . (I also have to shim because React expects it to be defined for some reason.)\nFinding this quite useful. But it has been a bit inconvenient to have among the children when an element is conditionally rendered.\nThe idea was to make the helpers ignore null which could help with that. Perhaps we could have return an iterable which traverses nested arrays and ignores null.\nReally? Allowing nulls was a change intentionally introduced a long time ago. In I have an implementation of toArray.\nAllowing empty children (null, undefined, boolean) was a controversial topic, where we eventually landed on null/boolean/undefined being passed through. That way you could explicitly treat an empty slot as something special. This landed very early on before we really started seeing pattern developing. However, IMO, we've seen that this leads to inconsistent implementations where null slots will break and is not possible to use. It is unclear whether a set of children allows nullable slots, and if they do, it is unclear what that means. For example, in a grid layout component, does an empty slot mean that there should be an empty column in the grid, or that it should be skipped? Therefore, a lot of our components end up with explicit null checks. Meaning boilerplate, and inconsistent behavior when they're forgotten.", "commid": "react_issue_2393", "tokennum": 498}], "negative_passages": []} | |
| {"query_id": "q-en-react-083d62956cf05470274440705503ba0a0734b57f8b4e261f16d6ac1983b31d37", "query": "var React = require('React'); var ReactElement = require('ReactElement'); var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter'); <ins> var ReactCompositeComponent = require('ReactCompositeComponent'); var ReactInstanceHandles = require('ReactInstanceHandles'); </ins> var ReactInstanceMap = require('ReactInstanceMap'); var ReactMount = require('ReactMount'); var ReactUpdates = require('ReactUpdates'); var SyntheticEvent = require('SyntheticEvent'); var assign = require('Object.assign'); <ins> var instantiateReactComponent = require('instantiateReactComponent'); </ins> var topLevelTypes = EventConstants.topLevelTypes;", "positive_passages": [{"docid": "doc-en-react-26f74882fe59ad2106ea606628fef442808db170983d47929460fee2f487ed92", "text": "Therefore, I think the default should be to filter out nulls which is consistent with the behavior of the built-ins components. It is still possible to get access to the raw data if you have a different type of children in mind where empty slots is meaningful.\nHow should this work with the TestUtils functions. For example, this fails: I can't see any other info on mentioned at the start of this issue, is this what I'm missing? My end goal is simply to test that if I pass in 10 articles then 10 components get rendered. Any help would be awesome.\nHi David, the and functions are meant to be used with the output of , not shallow rendering. React doesn't currently provide a helper that will traverse trees for you. Your options for now are to describe the structure of the tree explicitly as in lines 4-5 of your example, or write your own helper module to find descendants you care about. hasn't been implemented yet. Refer to the for what's actually in React.\nCool, thanks for the reply I've returned to just using since the components I'm testing (and their children) don't have state/stores so don't really need mocking out anyway. One last (maybe stupid) question, what does mean?\nSo, I am trying to use Shallow Rendering and have it mostly only thing left I can\u2019t figure out is the recommended way to mock events and how to get with events to pass. I've attempted to use the method directly from the in the test (). This seems dirty\u2026is there a way to just say or something? I could post this on Stack Overflow, but I have had very little luck finding good information about Shallow Rendering online. If anyone has experience with shallow rendering and can give me some help you will be my hero... Source code: ! !\nIf I have an issue with shallow rendering, should I create a new issue, or post it here?\nNew issue please.\nyou might find that helps in providing higher-level assertions for the sort of thing you're doing there. In that particular case, I would avoid asserting on the event handler of the anchor in that test - but a different test would want to call to test the handler.\nSuper late reply, but \"scry\" is a fancy word for \"find\". I'm not sure why we don't just use \"find\".", "commid": "react_issue_2393", "tokennum": 500}], "negative_passages": []} | |
| {"query_id": "q-en-react-083d62956cf05470274440705503ba0a0734b57f8b4e261f16d6ac1983b31d37", "query": "var React = require('React'); var ReactElement = require('ReactElement'); var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter'); <ins> var ReactCompositeComponent = require('ReactCompositeComponent'); var ReactInstanceHandles = require('ReactInstanceHandles'); </ins> var ReactInstanceMap = require('ReactInstanceMap'); var ReactMount = require('ReactMount'); var ReactUpdates = require('ReactUpdates'); var SyntheticEvent = require('SyntheticEvent'); var assign = require('Object.assign'); <ins> var instantiateReactComponent = require('instantiateReactComponent'); </ins> var topLevelTypes = EventConstants.topLevelTypes;", "positive_passages": [{"docid": "doc-en-react-74686185b37a0ea269ae4ac6ffd7ebf8062f5d897e5d70eb2610fd72d3a71db1", "text": "Maybe to avoid confusion between the plural and singular forms, whose names would otherwise differ only by one \"s\".\nscry is because of legacy internal FB APIs. No reason.\nLike I'm keenly on the lookout for a way to correctly unit test event handling in React code. Is there any documentation that anyone could point me to? I've looked at but it didn't seem to have something that scratches my particular itch. Here's my scenario (cut down): Where Problem looks like this: I'd like to be able to assert that is wired up for my component but I'm at a loss as to how to do that....\nWhat you actually want is to assert that clicking interacts with the router. Pass in a fake context with a router mock (try Simon) then call Apologies for the brevity, on a phone.\nHi Thanks for responding. I'm not too clear on how to mock successfully when it comes to context. Digging through the source of I came up with this: However this dies a death with: Which makes me think I'm getting the context mocking wrong. Do you know how you successfully mock context with ? I'm using Jasmine (as you probably guessed!) I have a feeling I'm close...\nAre you using React 0.13? You're probably hitting the difference between parent & owner context. Skin deep has a wrapper that helps with this - there's a context example the test suite, but the short answer is to wrap your render in another function call and let skin deep set up the context. This problem should go away in 0.14\nI am using React 0.13, yes. If I port to 0.14 this issue should resolve? I might give that a crack if that's the case (it is in RC after all)\nProblems with the upgrade. I have raised . Will have to return to this later I think.\nI have written and as companion tools when testing with shallow rendering. It gives you the ability to diff on JSX strings rendered instead of React element objects.\nHi, I was wondering what was the state of: simulating events when using shallow rendering using refs when using shallow rendering How can we help make this happen if that's still planned?\nThis issue is pretty stale so I\u2019ll close it.", "commid": "react_issue_2393", "tokennum": 488}], "negative_passages": []} | |
| {"query_id": "q-en-react-083d62956cf05470274440705503ba0a0734b57f8b4e261f16d6ac1983b31d37", "query": "var React = require('React'); var ReactElement = require('ReactElement'); var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter'); <ins> var ReactCompositeComponent = require('ReactCompositeComponent'); var ReactInstanceHandles = require('ReactInstanceHandles'); </ins> var ReactInstanceMap = require('ReactInstanceMap'); var ReactMount = require('ReactMount'); var ReactUpdates = require('ReactUpdates'); var SyntheticEvent = require('SyntheticEvent'); var assign = require('Object.assign'); <ins> var instantiateReactComponent = require('instantiateReactComponent'); </ins> var topLevelTypes = EventConstants.topLevelTypes;", "positive_passages": [{"docid": "doc-en-react-648b97e94c725256b26e1bd96a5fd371b8015ffce2e3e1a0a44a2263c4489568", "text": "If there are specific features you miss in the shallow renderer please create new issues with proposals on how they should work. Note that we a new that is much more feature-complete.", "commid": "react_issue_2393", "tokennum": 37}], "negative_passages": []} | |
| {"query_id": "q-en-react-0baebf45e9b87220c29281eb8bfbb60ebe3253a5952c16951a9c107393d9bf82", "query": "// an external backing store so that we can freeze the whole object. // This can be replaced with a WeakMap once they are implemented in // commonly used development environments. <del> this._store = { validated: false, props: props }; </del> <ins> this._store = { props: props }; // To make comparing ReactElements easier for testing purposes, we make // the validation flag non-enumerable (where possible, which should // include every environment we run tests in), so the test framework // ignores it. try { Object.defineProperty(this._store, 'validated', { configurable: false, enumerable: false, writable: true }); } catch (x) { } this._store.validated = false; </ins> // We're not allowed to set props directly on the object so we early // return and rely on the prototype membrane to forward to the backing", "positive_passages": [{"docid": "doc-en-react-43bd8c935fcf00bee8061fadc9d53ee4ce08d7674cd1b756a95fad46456d6e25", "text": "We need a way to test the output of a single level React component without resolving it all the way down to the bottom layer (whatever that is). I'm thinking something like this: Basically, this fix needs to go through the entire life-cycle of ReactCompositeComponent. It just needs to bail out whenever it would've continued rendering.\nReopened so that we can track the remaining features (refs etc.)\nWeird, I thought GitHub only closed issues if you used language like \"fixes #NNNN\", not if you simply mentioned the issue at all. Sorry about that.\nThe PR text included \"WIP to \"\nIs the rest (refs support) blocked by or can more work be done now?\nAny reason this doesn't support other than that it's not implemented yet? I was hoping to do something like\nthat's supposed to work. Can you post a minimal repro?\nHow do you do this? does not return an instance.\nIt works if I use so I think could just return that from . (I also have to shim because React expects it to be defined for some reason.)\nFinding this quite useful. But it has been a bit inconvenient to have among the children when an element is conditionally rendered.\nThe idea was to make the helpers ignore null which could help with that. Perhaps we could have return an iterable which traverses nested arrays and ignores null.\nReally? Allowing nulls was a change intentionally introduced a long time ago. In I have an implementation of toArray.\nAllowing empty children (null, undefined, boolean) was a controversial topic, where we eventually landed on null/boolean/undefined being passed through. That way you could explicitly treat an empty slot as something special. This landed very early on before we really started seeing pattern developing. However, IMO, we've seen that this leads to inconsistent implementations where null slots will break and is not possible to use. It is unclear whether a set of children allows nullable slots, and if they do, it is unclear what that means. For example, in a grid layout component, does an empty slot mean that there should be an empty column in the grid, or that it should be skipped? Therefore, a lot of our components end up with explicit null checks. Meaning boilerplate, and inconsistent behavior when they're forgotten.", "commid": "react_issue_2393", "tokennum": 498}], "negative_passages": []} | |
| {"query_id": "q-en-react-0baebf45e9b87220c29281eb8bfbb60ebe3253a5952c16951a9c107393d9bf82", "query": "// an external backing store so that we can freeze the whole object. // This can be replaced with a WeakMap once they are implemented in // commonly used development environments. <del> this._store = { validated: false, props: props }; </del> <ins> this._store = { props: props }; // To make comparing ReactElements easier for testing purposes, we make // the validation flag non-enumerable (where possible, which should // include every environment we run tests in), so the test framework // ignores it. try { Object.defineProperty(this._store, 'validated', { configurable: false, enumerable: false, writable: true }); } catch (x) { } this._store.validated = false; </ins> // We're not allowed to set props directly on the object so we early // return and rely on the prototype membrane to forward to the backing", "positive_passages": [{"docid": "doc-en-react-26f74882fe59ad2106ea606628fef442808db170983d47929460fee2f487ed92", "text": "Therefore, I think the default should be to filter out nulls which is consistent with the behavior of the built-ins components. It is still possible to get access to the raw data if you have a different type of children in mind where empty slots is meaningful.\nHow should this work with the TestUtils functions. For example, this fails: I can't see any other info on mentioned at the start of this issue, is this what I'm missing? My end goal is simply to test that if I pass in 10 articles then 10 components get rendered. Any help would be awesome.\nHi David, the and functions are meant to be used with the output of , not shallow rendering. React doesn't currently provide a helper that will traverse trees for you. Your options for now are to describe the structure of the tree explicitly as in lines 4-5 of your example, or write your own helper module to find descendants you care about. hasn't been implemented yet. Refer to the for what's actually in React.\nCool, thanks for the reply I've returned to just using since the components I'm testing (and their children) don't have state/stores so don't really need mocking out anyway. One last (maybe stupid) question, what does mean?\nSo, I am trying to use Shallow Rendering and have it mostly only thing left I can\u2019t figure out is the recommended way to mock events and how to get with events to pass. I've attempted to use the method directly from the in the test (). This seems dirty\u2026is there a way to just say or something? I could post this on Stack Overflow, but I have had very little luck finding good information about Shallow Rendering online. If anyone has experience with shallow rendering and can give me some help you will be my hero... Source code: ! !\nIf I have an issue with shallow rendering, should I create a new issue, or post it here?\nNew issue please.\nyou might find that helps in providing higher-level assertions for the sort of thing you're doing there. In that particular case, I would avoid asserting on the event handler of the anchor in that test - but a different test would want to call to test the handler.\nSuper late reply, but \"scry\" is a fancy word for \"find\". I'm not sure why we don't just use \"find\".", "commid": "react_issue_2393", "tokennum": 500}], "negative_passages": []} | |
| {"query_id": "q-en-react-0baebf45e9b87220c29281eb8bfbb60ebe3253a5952c16951a9c107393d9bf82", "query": "// an external backing store so that we can freeze the whole object. // This can be replaced with a WeakMap once they are implemented in // commonly used development environments. <del> this._store = { validated: false, props: props }; </del> <ins> this._store = { props: props }; // To make comparing ReactElements easier for testing purposes, we make // the validation flag non-enumerable (where possible, which should // include every environment we run tests in), so the test framework // ignores it. try { Object.defineProperty(this._store, 'validated', { configurable: false, enumerable: false, writable: true }); } catch (x) { } this._store.validated = false; </ins> // We're not allowed to set props directly on the object so we early // return and rely on the prototype membrane to forward to the backing", "positive_passages": [{"docid": "doc-en-react-74686185b37a0ea269ae4ac6ffd7ebf8062f5d897e5d70eb2610fd72d3a71db1", "text": "Maybe to avoid confusion between the plural and singular forms, whose names would otherwise differ only by one \"s\".\nscry is because of legacy internal FB APIs. No reason.\nLike I'm keenly on the lookout for a way to correctly unit test event handling in React code. Is there any documentation that anyone could point me to? I've looked at but it didn't seem to have something that scratches my particular itch. Here's my scenario (cut down): Where Problem looks like this: I'd like to be able to assert that is wired up for my component but I'm at a loss as to how to do that....\nWhat you actually want is to assert that clicking interacts with the router. Pass in a fake context with a router mock (try Simon) then call Apologies for the brevity, on a phone.\nHi Thanks for responding. I'm not too clear on how to mock successfully when it comes to context. Digging through the source of I came up with this: However this dies a death with: Which makes me think I'm getting the context mocking wrong. Do you know how you successfully mock context with ? I'm using Jasmine (as you probably guessed!) I have a feeling I'm close...\nAre you using React 0.13? You're probably hitting the difference between parent & owner context. Skin deep has a wrapper that helps with this - there's a context example the test suite, but the short answer is to wrap your render in another function call and let skin deep set up the context. This problem should go away in 0.14\nI am using React 0.13, yes. If I port to 0.14 this issue should resolve? I might give that a crack if that's the case (it is in RC after all)\nProblems with the upgrade. I have raised . Will have to return to this later I think.\nI have written and as companion tools when testing with shallow rendering. It gives you the ability to diff on JSX strings rendered instead of React element objects.\nHi, I was wondering what was the state of: simulating events when using shallow rendering using refs when using shallow rendering How can we help make this happen if that's still planned?\nThis issue is pretty stale so I\u2019ll close it.", "commid": "react_issue_2393", "tokennum": 488}], "negative_passages": []} | |
| {"query_id": "q-en-react-0baebf45e9b87220c29281eb8bfbb60ebe3253a5952c16951a9c107393d9bf82", "query": "// an external backing store so that we can freeze the whole object. // This can be replaced with a WeakMap once they are implemented in // commonly used development environments. <del> this._store = { validated: false, props: props }; </del> <ins> this._store = { props: props }; // To make comparing ReactElements easier for testing purposes, we make // the validation flag non-enumerable (where possible, which should // include every environment we run tests in), so the test framework // ignores it. try { Object.defineProperty(this._store, 'validated', { configurable: false, enumerable: false, writable: true }); } catch (x) { } this._store.validated = false; </ins> // We're not allowed to set props directly on the object so we early // return and rely on the prototype membrane to forward to the backing", "positive_passages": [{"docid": "doc-en-react-648b97e94c725256b26e1bd96a5fd371b8015ffce2e3e1a0a44a2263c4489568", "text": "If there are specific features you miss in the shallow renderer please create new issues with proposals on how they should work. Note that we a new that is much more feature-complete.", "commid": "react_issue_2393", "tokennum": 37}], "negative_passages": []} | |
| {"query_id": "q-en-react-0c05fc3684729bae7342c761e89db88783aa467325ed121fe6d2005c922ed2f0", "query": "ReactDOMIDOperations.updateInnerHTMLByID( 'testID', <del> {__html: ' testContent'} </del> <ins> ' testContent' </ins> ); expect(", "positive_passages": [{"docid": "doc-en-react-9306121422e93f6146586d22ff20af2d3e2d2860ed922937e70054809fe064b5", "text": "reported the following issue on IRC: (Both on master and 4.0) The repro case is: 1) Render 2) Render 3) Render the same as 1) The div has its innerHTML empty instead of . I don't really know what's going on. can you guys look at it?\nOne other tidbit: this only seems to happen when the value is exactly the same in step 3 as it was in step 1. If it's different (i.e. ), things work as expected.\nWhat happens if you change step 2 to a instead of a ? It works, right?\nI just reduced the test case to 19 lines.\nyeah changing 2) to use a span works as expected\nIf anyone wants to look into this, the bug is probably here\nI cannot reproduce what you are seeing: It also bugs if I use a different string\nI'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying.\nI know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a property to the React component containing the property. So, does not seem to work reproducibly, whereas seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a statement if that component gets rerendered multiple times with different inner content. Just posting this here in case other people have the same issue and stumble upon this.\nthx you saved my day :-)\nSeems like the issue is back again. Thanks, solves the problem for me too.\nIf any of you can post a simple repro case showing the broken behavior here, I'd be happy to take a look at fixing it.\nTook me a while to repro, but here you go: (ugly, but demonstrates the issue well)\nThanks. This is the same issue as . No fix currently, but using the key as a workaround is fine and I'll see if we can fix this sometime.\nThanks that was giving me fits!\nIf anyone is still seeing issues on 0.14, please make a new issue with a simple repro case.", "commid": "react_issue_377", "tokennum": 469}], "negative_passages": []} | |
| {"query_id": "q-en-react-0c05fc3684729bae7342c761e89db88783aa467325ed121fe6d2005c922ed2f0", "query": "ReactDOMIDOperations.updateInnerHTMLByID( 'testID', <del> {__html: ' testContent'} </del> <ins> ' testContent' </ins> ); expect(", "positive_passages": [{"docid": "doc-en-react-2561d4a0be5f333acf881b6f80c1a973b0d2a5e9e6140ce5d6d62900271a0991", "text": "I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:\nReading out will rarely give you what you put in because the browser does various kinds of normalization on it. If you can repro with a standalone example though I'm happy to take a look.\nwell, that's more like a control shot :-)\nLooks like the issue still exist in 16.4.1 when using on a tag, you cannot nest other or . issue is fixed by replacing the container with a\nIf you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example. when using dangerouslySetInnerHTML on a tag, you cannot nest other or This sounds like browsers work. You can't nest into . This is why React warns when you do it (except in which case React can't validate it).", "commid": "react_issue_377", "tokennum": 312}], "negative_passages": []} | |
| {"query_id": "q-en-react-0fd04f68f41f021225646be2e9021a029743e7a569b88b7e56b7cc18503d5e7f", "query": "const commitTrees = ((rootToCommitTreeMap.get( rootID, ): any): Array<CommitTree>); if (commitIndex < commitTrees.length) { return commitTrees[commitIndex]; }", "positive_passages": [{"docid": "doc-en-react-512e76875da3b7a71346eeb963942c92d292dc79b671907e793003fa3dbd424a", "text": "Describe what you were doing when the bug occurred: back to go back through the frames following a profile session. I think I got to zero and then clicked it again and then it errored Please do not remove the text below this line DevTools version: 4.8.2- Call stack: at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) Component stack: at CommitRankedAutoSizer (chrome-) at div at div at div at SettingsModalContextController (chrome-) at ProfilerProfiler (chrome-) at ErrorBoundary (chrome-) at PortaledContent (chrome-) at div at div at ProfilerContextController (chrome-) at TreeContextController (chrome-) at SettingsContextController (chrome-) at ModalDialogContextController (chrome-) at DevToolsDevTools (chrome-)\nPlease how do I replicate this? I don't seem to be able to replicate it.\nsorry, I won't have time to create a mre. I was doing a recording on a site with a lot of components and a lot of frames in the recording. I ended up going to maybe frame 30 then clicking back rapidly to get back to 0 and I guess went to far or something. Feel free to close this, I thought that the logs might be enough and it was encouraging me to submit the issue.\nCan I have a look ?\nMaybe change this recursive function And use a loop going to correct the issue. If it is ok, i can work on it.\ncan you share how you were able to replicate the issue?\nI think for there to be a stack overflow from calling itself, it would need to have profiling data with thousands (?) of commits. This function only recurses (at most) once per commit when processing data, and then, too, only if you jump through commits you haven't yet processed (so 0 -N would recurse N times). That being said, it seems like we could also rewrite this function to be iterative without too much trouble. Done in PR !\nThat's quite possible actually. The issue I was trying to diagnose was high CPU usage on an app that has spreadsheet like functionality, i.e.", "commid": "react_issue_19839", "tokennum": 569}], "negative_passages": []} | |
| {"query_id": "q-en-react-0fd04f68f41f021225646be2e9021a029743e7a569b88b7e56b7cc18503d5e7f", "query": "const commitTrees = ((rootToCommitTreeMap.get( rootID, ): any): Array<CommitTree>); if (commitIndex < commitTrees.length) { return commitTrees[commitIndex]; }", "positive_passages": [{"docid": "doc-en-react-a841d72b091db1489f8c73d5bb09a3b5a8e633cc5d8c4984fa6afb7df739d217", "text": "lots of components so I was trying to see exactly what was taking all the CPU time. Thanks for the PR. Hopefully next time this crops up it will solve it.\nGreat Should be released sometime in the next few days.", "commid": "react_issue_19839", "tokennum": 45}], "negative_passages": []} | |
| {"query_id": "q-en-react-1631af01635fa911272da2ddd5bc78c624e8703a28e4b5e6b70ad95790e93906", "query": "return [<div />]; } <ins> function ComponentWithSymbolWarning() { console.warn('this is a symbol', Symbol('foo')); console.error('this is a symbol', Symbol.for('bar')); return null; } </ins> export default function ErrorsAndWarnings() { const [count, setCount] = useState(0); const handleClick = () => setCount(count + 1);", "positive_passages": [{"docid": "doc-en-react-32151ac5f4d8d7fcb6b59730e1224ffe5f513940e4fe6d4c7eec610e94d11802", "text": "<!-- Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest version of the relevant React packages to make sure your issue has not already been fixed. --React version: DevTools version 4.12.2- from within a React component where the last argument is typeof <!-- Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Issues without reproduction steps or code examples may be immediately closed as not actionable. --Link to code example: The bug only happens when you make a change, so if you use the code sandbox link you need, open a new window, active dev tools, open the React dev tools and then uncomment line 5: only then will the error actually happen. I've located the culprit to this line of code And would offer the following change <!-- Please provide a CodeSandbox (), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: --React DevTools is implicitly converting a Symbol to a string. React DevTools does not implicitly try to convert a Symbol to a string.\nThanks for the report. Also reproduced with DevTools version 4.12.3- in Chrome 90 In addition to fixing the bug, it would also be nice to guard against devtools failing so that the UI is unaffected if devtools is faulty. /cc\nYour the best, thanks for a quick turn around!", "commid": "react_issue_21332", "tokennum": 361}], "negative_passages": []} | |
| {"query_id": "q-en-react-1919755a26630a02897fbe5eba7e9a81ba7fa27a612b5acecfa17fc307ddd615", "query": "expectTextNode(e.childNodes[1], 'bar'); } }); <ins> itRenders( 'a component returning text node between two text nodes', async render => { const B = () => 'b'; const e = await render(<div>{'a'}<B />{'c'}</div>); if ( render === serverRender || render === clientRenderOnServerString || render === streamRender ) { // In the server render output there's a comment between them. expect(e.childNodes.length).toBe(5); expectTextNode(e.childNodes[0], 'a'); expectTextNode(e.childNodes[2], 'b'); expectTextNode(e.childNodes[4], 'c'); } else { expect(e.childNodes.length).toBe(3); expectTextNode(e.childNodes[0], 'a'); expectTextNode(e.childNodes[1], 'b'); expectTextNode(e.childNodes[2], 'c'); } }, ); itRenders('a tree with sibling host and text nodes', async render => { class X extends React.Component { render() { return [null, [<Y key=\"1\" />], false]; } } function Y() { return [<Z key=\"1\" />, ['c']]; } function Z() { return null; } const e = await render( <div> {[['a'], 'b']} <div> <X key=\"1\" /> d </div> e </div>, ); if ( render === serverRender || render === clientRenderOnServerString || render === streamRender ) { // In the server render output there's comments between text nodes. expect(e.childNodes.length).toBe(5); expectTextNode(e.childNodes[0], 'a'); expectTextNode(e.childNodes[2], 'b'); expect(e.childNodes[3].childNodes.length).toBe(3); expectTextNode(e.childNodes[3].childNodes[0], 'c'); expectTextNode(e.childNodes[3].childNodes[2], 'd'); expectTextNode(e.childNodes[4], 'e'); } else { expect(e.childNodes.length).toBe(4); expectTextNode(e.childNodes[0], 'a'); expectTextNode(e.childNodes[1], 'b'); expect(e.childNodes[2].childNodes.length).toBe(2); expectTextNode(e.childNodes[2].childNodes[0], 'c'); expectTextNode(e.childNodes[2].childNodes[1], 'd'); expectTextNode(e.childNodes[3], 'e'); } }); </ins> }); describe('number children', function() {", "positive_passages": [{"docid": "doc-en-react-ec5ecfe108c5622ae0f0ce83ae6ca196a4c0778b1ab6d72b9b10da2f746acbc9", "text": "Observed this on react This renders as . If you try to hydrate this you'll get the error: Text content did not match. Server: \"bc\" Client: \"b\".\nI suppose the bug here is that we do not separate from here but we should.\nReact has been released. Please update , , and (if you use it) to this version and let us know if it solved the issue! We\u2019d appreciate if you could test before Monday when we plan to get out.\nEverything looks good on my end, thanks!", "commid": "react_issue_10598", "tokennum": 112}], "negative_passages": []} | |
| {"query_id": "q-en-react-19df38ab2400bdd8864a6b1dd3d49b54b2e7ae46894154f19f62c49f61836d06", "query": "var inlineScriptCount = 0; <ins> // This method returns a nicely formated line of code pointing the // exactly location of the error `e`. // The line is limited in size so big lines of code are also shown // in a readable way. // Example: // // ... x', overflow:'scroll'}} id={} onScroll={this.scroll} class=\" ... // ^ var createSourceCodeErrorMessage = function(code, e) { var sourceLines = code.split('n'); var erroneousLine = sourceLines[e.lineNumber - 1]; // Removes any leading indenting spaces and gets the number of // chars indenting the `erroneousLine` var indentation = 0; erroneousLine = erroneousLine.replace(/^s+/, function(leadingSpaces) { indentation = leadingSpaces.length; return ''; }); // Defines the number of characters that are going to show // before and after the erroneous code var LIMIT = 30; var errorColumn = e.column - indentation; if (errorColumn > LIMIT) { erroneousLine = '... ' + erroneousLine.slice(errorColumn - LIMIT); errorColumn = 4 + LIMIT; } if (erroneousLine.length - errorColumn > LIMIT) { erroneousLine = erroneousLine.slice(0, errorColumn + LIMIT) + ' ...'; } var message = 'nn' + erroneousLine + 'n'; message += new Array(errorColumn - 1).join(' ') + '^'; return message; }; </ins> var transformCode = function(code, source) { var jsx = docblock.parseAsObject(docblock.extract(code)).jsx; if (jsx) { <del> var transformed = transformReact(code); </del> <ins> try { var transformed = transformReact(code); } catch(e) { e.message += 'n at '; if (source) { if ('fileName' in e) { // We set `fileName` if it's supported by this error object and // a `source` was provided. // The error will correctly point to `source` in Firefox. e.fileName = source; } e.message += source + ':' + e.lineNumber + ':' + e.column; } else { e.message += location.href; } e.message += createSourceCodeErrorMessage(code, e); throw e; } </ins> var map = transformed.sourceMap.toJSON(); if (source == null) {", "positive_passages": [{"docid": "doc-en-react-54830cbd0e807e9ec25aed786a1e0f731e3699add76f794c7e60bf706c749bf6", "text": "This makes it basically unusable in any nontrivial project. While people shouldn't be using this in production, we should still fix this bug for newbies and people using it for hackathons.\nThis should be relatively easy. What should we do with inline tags?", "commid": "react_issue_393", "tokennum": 57}], "negative_passages": []} | |
| {"query_id": "q-en-react-21f6b6defd388b3632be63440e7f793e2d8c828e38be0cab59df30fba9478e50", "query": "} const {operations} = dataForRoot; <ins> if (operations.length <= commitIndex) { throw Error( `getCommitTree(): Invalid commit \"${commitIndex}\" for root \"${rootID}\". There are only \"${operations.length}\" commits.`, ); } </ins> <del> // Commits are generated sequentially and cached. // If this is the very first commit, start with the cached snapshot and apply the first mutation. // Otherwise load (or generate) the previous commit and append a mutation to it. if (commitIndex === 0) { const nodes = new Map(); // Construct the initial tree. recursivelyInitializeTree(rootID, 0, nodes, dataForRoot); </del> <ins> let commitTree: CommitTree = ((null: any): CommitTree); for (let index = commitTrees.length; index <= commitIndex; index++) { // Commits are generated sequentially and cached. // If this is the very first commit, start with the cached snapshot and apply the first mutation. // Otherwise load (or generate) the previous commit and append a mutation to it. if (index === 0) { const nodes = new Map(); </ins> <del> // Mutate the tree if (operations != null && commitIndex < operations.length) { const commitTree = updateTree({nodes, rootID}, operations[commitIndex]); </del> <ins> // Construct the initial tree. recursivelyInitializeTree(rootID, 0, nodes, dataForRoot); </ins> <del> if (__DEBUG__) { __printTree(commitTree); } </del> <ins> // Mutate the tree if (operations != null && index < operations.length) { commitTree = updateTree({nodes, rootID}, operations[index]); </ins> <del> commitTrees.push(commitTree); return commitTree; } } else { const previousCommitTree = getCommitTree({ commitIndex: commitIndex - 1, profilerStore, rootID, }); </del> <ins> if (__DEBUG__) { __printTree(commitTree); } </ins> <del> if (operations != null && commitIndex < operations.length) { const commitTree = updateTree( previousCommitTree, operations[commitIndex], ); </del> <ins> commitTrees.push(commitTree); } } else { const previousCommitTree = commitTrees[index - 1]; commitTree = updateTree(previousCommitTree, operations[index]); </ins> if (__DEBUG__) { __printTree(commitTree); } commitTrees.push(commitTree); <del> return commitTree; </del> } } <del> throw Error( `getCommitTree(): Unable to reconstruct tree for root \"${rootID}\" and commit \"${commitIndex}\"`, ); </del> <ins> return commitTree; </ins> } function recursivelyInitializeTree(", "positive_passages": [{"docid": "doc-en-react-512e76875da3b7a71346eeb963942c92d292dc79b671907e793003fa3dbd424a", "text": "Describe what you were doing when the bug occurred: back to go back through the frames following a profile session. I think I got to zero and then clicked it again and then it errored Please do not remove the text below this line DevTools version: 4.8.2- Call stack: at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) at getCommitTree (chrome-) Component stack: at CommitRankedAutoSizer (chrome-) at div at div at div at SettingsModalContextController (chrome-) at ProfilerProfiler (chrome-) at ErrorBoundary (chrome-) at PortaledContent (chrome-) at div at div at ProfilerContextController (chrome-) at TreeContextController (chrome-) at SettingsContextController (chrome-) at ModalDialogContextController (chrome-) at DevToolsDevTools (chrome-)\nPlease how do I replicate this? I don't seem to be able to replicate it.\nsorry, I won't have time to create a mre. I was doing a recording on a site with a lot of components and a lot of frames in the recording. I ended up going to maybe frame 30 then clicking back rapidly to get back to 0 and I guess went to far or something. Feel free to close this, I thought that the logs might be enough and it was encouraging me to submit the issue.\nCan I have a look ?\nMaybe change this recursive function And use a loop going to correct the issue. If it is ok, i can work on it.\ncan you share how you were able to replicate the issue?\nI think for there to be a stack overflow from calling itself, it would need to have profiling data with thousands (?) of commits. This function only recurses (at most) once per commit when processing data, and then, too, only if you jump through commits you haven't yet processed (so 0 -N would recurse N times). That being said, it seems like we could also rewrite this function to be iterative without too much trouble. Done in PR !\nThat's quite possible actually. The issue I was trying to diagnose was high CPU usage on an app that has spreadsheet like functionality, i.e.", "commid": "react_issue_19839", "tokennum": 569}], "negative_passages": []} | |
| {"query_id": "q-en-react-21f6b6defd388b3632be63440e7f793e2d8c828e38be0cab59df30fba9478e50", "query": "} const {operations} = dataForRoot; <ins> if (operations.length <= commitIndex) { throw Error( `getCommitTree(): Invalid commit \"${commitIndex}\" for root \"${rootID}\". There are only \"${operations.length}\" commits.`, ); } </ins> <del> // Commits are generated sequentially and cached. // If this is the very first commit, start with the cached snapshot and apply the first mutation. // Otherwise load (or generate) the previous commit and append a mutation to it. if (commitIndex === 0) { const nodes = new Map(); // Construct the initial tree. recursivelyInitializeTree(rootID, 0, nodes, dataForRoot); </del> <ins> let commitTree: CommitTree = ((null: any): CommitTree); for (let index = commitTrees.length; index <= commitIndex; index++) { // Commits are generated sequentially and cached. // If this is the very first commit, start with the cached snapshot and apply the first mutation. // Otherwise load (or generate) the previous commit and append a mutation to it. if (index === 0) { const nodes = new Map(); </ins> <del> // Mutate the tree if (operations != null && commitIndex < operations.length) { const commitTree = updateTree({nodes, rootID}, operations[commitIndex]); </del> <ins> // Construct the initial tree. recursivelyInitializeTree(rootID, 0, nodes, dataForRoot); </ins> <del> if (__DEBUG__) { __printTree(commitTree); } </del> <ins> // Mutate the tree if (operations != null && index < operations.length) { commitTree = updateTree({nodes, rootID}, operations[index]); </ins> <del> commitTrees.push(commitTree); return commitTree; } } else { const previousCommitTree = getCommitTree({ commitIndex: commitIndex - 1, profilerStore, rootID, }); </del> <ins> if (__DEBUG__) { __printTree(commitTree); } </ins> <del> if (operations != null && commitIndex < operations.length) { const commitTree = updateTree( previousCommitTree, operations[commitIndex], ); </del> <ins> commitTrees.push(commitTree); } } else { const previousCommitTree = commitTrees[index - 1]; commitTree = updateTree(previousCommitTree, operations[index]); </ins> if (__DEBUG__) { __printTree(commitTree); } commitTrees.push(commitTree); <del> return commitTree; </del> } } <del> throw Error( `getCommitTree(): Unable to reconstruct tree for root \"${rootID}\" and commit \"${commitIndex}\"`, ); </del> <ins> return commitTree; </ins> } function recursivelyInitializeTree(", "positive_passages": [{"docid": "doc-en-react-a841d72b091db1489f8c73d5bb09a3b5a8e633cc5d8c4984fa6afb7df739d217", "text": "lots of components so I was trying to see exactly what was taking all the CPU time. Thanks for the PR. Hopefully next time this crops up it will solve it.\nGreat Should be released sometime in the next few days.", "commid": "react_issue_19839", "tokennum": 45}], "negative_passages": []} | |
| {"query_id": "q-en-react-25aec233a2a1cc53dfad038d1962303504c42add268a6140261190df24110126", "query": "<ins> /** * Copyright 2013-2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @emails react-core */ \"use strict\"; var React; var ReactTestUtils; var mocks; var warn; describe('ReactTestUtils', function() { beforeEach(function() { mocks = require('mocks'); React = require('React'); ReactTestUtils = require('ReactTestUtils'); warn = console.warn; console.warn = mocks.getMockFunction(); }); afterEach(function() { console.warn = warn; }); it('should have shallow rendering', function() { var SomeComponent = React.createClass({ render: function() { return ( <div> <span className=\"child1\" /> <span className=\"child2\" /> </div> ); } }); var shallowRenderer = ReactTestUtils.createRenderer(); shallowRenderer.render(<SomeComponent />); var result = shallowRenderer.getRenderOutput(); expect(result.type).toBe('div'); expect(result.props.children).toEqual([ <span className=\"child1\" />, <span className=\"child2\" /> ]); }); it('lets you update shallowly rendered components', function() { var SomeComponent = React.createClass({ getInitialState: function() { return {clicked: false}; }, onClick: function() { this.setState({clicked: true}); }, render: function() { var className = this.state.clicked ? 'was-clicked' : ''; if (this.props.aNew === 'prop') { return ( <a href=\"#\" onClick={this.onClick} className={className}> Test link </a> ); } else { return ( <div> <span className=\"child1\" /> <span className=\"child2\" /> </div> ); } } }); var shallowRenderer = ReactTestUtils.createRenderer(); shallowRenderer.render(<SomeComponent />); var result = shallowRenderer.getRenderOutput(); expect(result.type).toBe('div'); expect(result.props.children).toEqual([ <span className=\"child1\" />, <span className=\"child2\" /> ]); shallowRenderer.render(<SomeComponent aNew=\"prop\" />); var updatedResult = shallowRenderer.getRenderOutput(); expect(updatedResult.type).toBe('a'); var mockEvent = {}; updatedResult.props.onClick(mockEvent); var updatedResultCausedByClick = shallowRenderer.getRenderOutput(); expect(updatedResultCausedByClick.type).toBe('a'); expect(updatedResultCausedByClick.props.className).toBe('was-clicked'); }); }); </ins>", "positive_passages": [{"docid": "doc-en-react-43bd8c935fcf00bee8061fadc9d53ee4ce08d7674cd1b756a95fad46456d6e25", "text": "We need a way to test the output of a single level React component without resolving it all the way down to the bottom layer (whatever that is). I'm thinking something like this: Basically, this fix needs to go through the entire life-cycle of ReactCompositeComponent. It just needs to bail out whenever it would've continued rendering.\nReopened so that we can track the remaining features (refs etc.)\nWeird, I thought GitHub only closed issues if you used language like \"fixes #NNNN\", not if you simply mentioned the issue at all. Sorry about that.\nThe PR text included \"WIP to \"\nIs the rest (refs support) blocked by or can more work be done now?\nAny reason this doesn't support other than that it's not implemented yet? I was hoping to do something like\nthat's supposed to work. Can you post a minimal repro?\nHow do you do this? does not return an instance.\nIt works if I use so I think could just return that from . (I also have to shim because React expects it to be defined for some reason.)\nFinding this quite useful. But it has been a bit inconvenient to have among the children when an element is conditionally rendered.\nThe idea was to make the helpers ignore null which could help with that. Perhaps we could have return an iterable which traverses nested arrays and ignores null.\nReally? Allowing nulls was a change intentionally introduced a long time ago. In I have an implementation of toArray.\nAllowing empty children (null, undefined, boolean) was a controversial topic, where we eventually landed on null/boolean/undefined being passed through. That way you could explicitly treat an empty slot as something special. This landed very early on before we really started seeing pattern developing. However, IMO, we've seen that this leads to inconsistent implementations where null slots will break and is not possible to use. It is unclear whether a set of children allows nullable slots, and if they do, it is unclear what that means. For example, in a grid layout component, does an empty slot mean that there should be an empty column in the grid, or that it should be skipped? Therefore, a lot of our components end up with explicit null checks. Meaning boilerplate, and inconsistent behavior when they're forgotten.", "commid": "react_issue_2393", "tokennum": 498}], "negative_passages": []} | |
| {"query_id": "q-en-react-25aec233a2a1cc53dfad038d1962303504c42add268a6140261190df24110126", "query": "<ins> /** * Copyright 2013-2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @emails react-core */ \"use strict\"; var React; var ReactTestUtils; var mocks; var warn; describe('ReactTestUtils', function() { beforeEach(function() { mocks = require('mocks'); React = require('React'); ReactTestUtils = require('ReactTestUtils'); warn = console.warn; console.warn = mocks.getMockFunction(); }); afterEach(function() { console.warn = warn; }); it('should have shallow rendering', function() { var SomeComponent = React.createClass({ render: function() { return ( <div> <span className=\"child1\" /> <span className=\"child2\" /> </div> ); } }); var shallowRenderer = ReactTestUtils.createRenderer(); shallowRenderer.render(<SomeComponent />); var result = shallowRenderer.getRenderOutput(); expect(result.type).toBe('div'); expect(result.props.children).toEqual([ <span className=\"child1\" />, <span className=\"child2\" /> ]); }); it('lets you update shallowly rendered components', function() { var SomeComponent = React.createClass({ getInitialState: function() { return {clicked: false}; }, onClick: function() { this.setState({clicked: true}); }, render: function() { var className = this.state.clicked ? 'was-clicked' : ''; if (this.props.aNew === 'prop') { return ( <a href=\"#\" onClick={this.onClick} className={className}> Test link </a> ); } else { return ( <div> <span className=\"child1\" /> <span className=\"child2\" /> </div> ); } } }); var shallowRenderer = ReactTestUtils.createRenderer(); shallowRenderer.render(<SomeComponent />); var result = shallowRenderer.getRenderOutput(); expect(result.type).toBe('div'); expect(result.props.children).toEqual([ <span className=\"child1\" />, <span className=\"child2\" /> ]); shallowRenderer.render(<SomeComponent aNew=\"prop\" />); var updatedResult = shallowRenderer.getRenderOutput(); expect(updatedResult.type).toBe('a'); var mockEvent = {}; updatedResult.props.onClick(mockEvent); var updatedResultCausedByClick = shallowRenderer.getRenderOutput(); expect(updatedResultCausedByClick.type).toBe('a'); expect(updatedResultCausedByClick.props.className).toBe('was-clicked'); }); }); </ins>", "positive_passages": [{"docid": "doc-en-react-26f74882fe59ad2106ea606628fef442808db170983d47929460fee2f487ed92", "text": "Therefore, I think the default should be to filter out nulls which is consistent with the behavior of the built-ins components. It is still possible to get access to the raw data if you have a different type of children in mind where empty slots is meaningful.\nHow should this work with the TestUtils functions. For example, this fails: I can't see any other info on mentioned at the start of this issue, is this what I'm missing? My end goal is simply to test that if I pass in 10 articles then 10 components get rendered. Any help would be awesome.\nHi David, the and functions are meant to be used with the output of , not shallow rendering. React doesn't currently provide a helper that will traverse trees for you. Your options for now are to describe the structure of the tree explicitly as in lines 4-5 of your example, or write your own helper module to find descendants you care about. hasn't been implemented yet. Refer to the for what's actually in React.\nCool, thanks for the reply I've returned to just using since the components I'm testing (and their children) don't have state/stores so don't really need mocking out anyway. One last (maybe stupid) question, what does mean?\nSo, I am trying to use Shallow Rendering and have it mostly only thing left I can\u2019t figure out is the recommended way to mock events and how to get with events to pass. I've attempted to use the method directly from the in the test (). This seems dirty\u2026is there a way to just say or something? I could post this on Stack Overflow, but I have had very little luck finding good information about Shallow Rendering online. If anyone has experience with shallow rendering and can give me some help you will be my hero... Source code: ! !\nIf I have an issue with shallow rendering, should I create a new issue, or post it here?\nNew issue please.\nyou might find that helps in providing higher-level assertions for the sort of thing you're doing there. In that particular case, I would avoid asserting on the event handler of the anchor in that test - but a different test would want to call to test the handler.\nSuper late reply, but \"scry\" is a fancy word for \"find\". I'm not sure why we don't just use \"find\".", "commid": "react_issue_2393", "tokennum": 500}], "negative_passages": []} | |
| {"query_id": "q-en-react-25aec233a2a1cc53dfad038d1962303504c42add268a6140261190df24110126", "query": "<ins> /** * Copyright 2013-2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @emails react-core */ \"use strict\"; var React; var ReactTestUtils; var mocks; var warn; describe('ReactTestUtils', function() { beforeEach(function() { mocks = require('mocks'); React = require('React'); ReactTestUtils = require('ReactTestUtils'); warn = console.warn; console.warn = mocks.getMockFunction(); }); afterEach(function() { console.warn = warn; }); it('should have shallow rendering', function() { var SomeComponent = React.createClass({ render: function() { return ( <div> <span className=\"child1\" /> <span className=\"child2\" /> </div> ); } }); var shallowRenderer = ReactTestUtils.createRenderer(); shallowRenderer.render(<SomeComponent />); var result = shallowRenderer.getRenderOutput(); expect(result.type).toBe('div'); expect(result.props.children).toEqual([ <span className=\"child1\" />, <span className=\"child2\" /> ]); }); it('lets you update shallowly rendered components', function() { var SomeComponent = React.createClass({ getInitialState: function() { return {clicked: false}; }, onClick: function() { this.setState({clicked: true}); }, render: function() { var className = this.state.clicked ? 'was-clicked' : ''; if (this.props.aNew === 'prop') { return ( <a href=\"#\" onClick={this.onClick} className={className}> Test link </a> ); } else { return ( <div> <span className=\"child1\" /> <span className=\"child2\" /> </div> ); } } }); var shallowRenderer = ReactTestUtils.createRenderer(); shallowRenderer.render(<SomeComponent />); var result = shallowRenderer.getRenderOutput(); expect(result.type).toBe('div'); expect(result.props.children).toEqual([ <span className=\"child1\" />, <span className=\"child2\" /> ]); shallowRenderer.render(<SomeComponent aNew=\"prop\" />); var updatedResult = shallowRenderer.getRenderOutput(); expect(updatedResult.type).toBe('a'); var mockEvent = {}; updatedResult.props.onClick(mockEvent); var updatedResultCausedByClick = shallowRenderer.getRenderOutput(); expect(updatedResultCausedByClick.type).toBe('a'); expect(updatedResultCausedByClick.props.className).toBe('was-clicked'); }); }); </ins>", "positive_passages": [{"docid": "doc-en-react-74686185b37a0ea269ae4ac6ffd7ebf8062f5d897e5d70eb2610fd72d3a71db1", "text": "Maybe to avoid confusion between the plural and singular forms, whose names would otherwise differ only by one \"s\".\nscry is because of legacy internal FB APIs. No reason.\nLike I'm keenly on the lookout for a way to correctly unit test event handling in React code. Is there any documentation that anyone could point me to? I've looked at but it didn't seem to have something that scratches my particular itch. Here's my scenario (cut down): Where Problem looks like this: I'd like to be able to assert that is wired up for my component but I'm at a loss as to how to do that....\nWhat you actually want is to assert that clicking interacts with the router. Pass in a fake context with a router mock (try Simon) then call Apologies for the brevity, on a phone.\nHi Thanks for responding. I'm not too clear on how to mock successfully when it comes to context. Digging through the source of I came up with this: However this dies a death with: Which makes me think I'm getting the context mocking wrong. Do you know how you successfully mock context with ? I'm using Jasmine (as you probably guessed!) I have a feeling I'm close...\nAre you using React 0.13? You're probably hitting the difference between parent & owner context. Skin deep has a wrapper that helps with this - there's a context example the test suite, but the short answer is to wrap your render in another function call and let skin deep set up the context. This problem should go away in 0.14\nI am using React 0.13, yes. If I port to 0.14 this issue should resolve? I might give that a crack if that's the case (it is in RC after all)\nProblems with the upgrade. I have raised . Will have to return to this later I think.\nI have written and as companion tools when testing with shallow rendering. It gives you the ability to diff on JSX strings rendered instead of React element objects.\nHi, I was wondering what was the state of: simulating events when using shallow rendering using refs when using shallow rendering How can we help make this happen if that's still planned?\nThis issue is pretty stale so I\u2019ll close it.", "commid": "react_issue_2393", "tokennum": 488}], "negative_passages": []} | |
| {"query_id": "q-en-react-25aec233a2a1cc53dfad038d1962303504c42add268a6140261190df24110126", "query": "<ins> /** * Copyright 2013-2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @emails react-core */ \"use strict\"; var React; var ReactTestUtils; var mocks; var warn; describe('ReactTestUtils', function() { beforeEach(function() { mocks = require('mocks'); React = require('React'); ReactTestUtils = require('ReactTestUtils'); warn = console.warn; console.warn = mocks.getMockFunction(); }); afterEach(function() { console.warn = warn; }); it('should have shallow rendering', function() { var SomeComponent = React.createClass({ render: function() { return ( <div> <span className=\"child1\" /> <span className=\"child2\" /> </div> ); } }); var shallowRenderer = ReactTestUtils.createRenderer(); shallowRenderer.render(<SomeComponent />); var result = shallowRenderer.getRenderOutput(); expect(result.type).toBe('div'); expect(result.props.children).toEqual([ <span className=\"child1\" />, <span className=\"child2\" /> ]); }); it('lets you update shallowly rendered components', function() { var SomeComponent = React.createClass({ getInitialState: function() { return {clicked: false}; }, onClick: function() { this.setState({clicked: true}); }, render: function() { var className = this.state.clicked ? 'was-clicked' : ''; if (this.props.aNew === 'prop') { return ( <a href=\"#\" onClick={this.onClick} className={className}> Test link </a> ); } else { return ( <div> <span className=\"child1\" /> <span className=\"child2\" /> </div> ); } } }); var shallowRenderer = ReactTestUtils.createRenderer(); shallowRenderer.render(<SomeComponent />); var result = shallowRenderer.getRenderOutput(); expect(result.type).toBe('div'); expect(result.props.children).toEqual([ <span className=\"child1\" />, <span className=\"child2\" /> ]); shallowRenderer.render(<SomeComponent aNew=\"prop\" />); var updatedResult = shallowRenderer.getRenderOutput(); expect(updatedResult.type).toBe('a'); var mockEvent = {}; updatedResult.props.onClick(mockEvent); var updatedResultCausedByClick = shallowRenderer.getRenderOutput(); expect(updatedResultCausedByClick.type).toBe('a'); expect(updatedResultCausedByClick.props.className).toBe('was-clicked'); }); }); </ins>", "positive_passages": [{"docid": "doc-en-react-648b97e94c725256b26e1bd96a5fd371b8015ffce2e3e1a0a44a2263c4489568", "text": "If there are specific features you miss in the shallow renderer please create new issues with proposals on how they should work. Note that we a new that is much more feature-complete.", "commid": "react_issue_2393", "tokennum": 37}], "negative_passages": []} | |
| {"query_id": "q-en-react-26b41bf412909ef9599cf66b12f5ea03573f2791da00c76fdc0f5b24e918d007", "query": "_updateDOMChildren: function(lastProps, transaction) { var nextProps = this.props; <del> var lastUsedContent = </del> <ins> var lastContent = </ins> CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; <del> var contentToUse = </del> <ins> var nextContent = </ins> CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; <ins> var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; </ins> // Note the use of `!=` which checks for null or undefined. <ins> var lastChildren = lastContent != null ? null : lastProps.children; var nextChildren = nextContent != null ? null : nextProps.children; </ins> <del> var lastUsedChildren = lastUsedContent != null ? null : lastProps.children; var childrenToUse = contentToUse != null ? null : nextProps.children; </del> <ins> // If we're switching from children to content/html or vice versa, remove // the old content var lastHasContentOrHtml = lastContent != null || lastHtml != null; var nextHasContentOrHtml = nextContent != null || nextHtml != null; if (lastChildren != null && nextChildren == null) { this.updateChildren(null, transaction); } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { this.updateTextContent(''); } </ins> <del> if (contentToUse != null) { var childrenRemoved = lastUsedChildren != null && childrenToUse == null; if (childrenRemoved) { this.updateChildren(null, transaction); } if (lastUsedContent !== contentToUse) { this.updateTextContent('' + contentToUse); </del> <ins> if (nextContent != null) { if (lastContent !== nextContent) { this.updateTextContent('' + nextContent); </ins> } <del> } else { var contentRemoved = lastUsedContent != null && contentToUse == null; if (contentRemoved) { this.updateTextContent(''); </del> <ins> } else if (nextHtml != null) { if (lastHtml !== nextHtml) { ReactComponent.DOMIDOperations.updateInnerHTMLByID( this._rootNodeID, nextHtml ); </ins> } <del> this.updateChildren(flattenChildren(nextProps.children), transaction); </del> <ins> } else if (nextChildren != null) { this.updateChildren(flattenChildren(nextChildren), transaction); </ins> } },", "positive_passages": [{"docid": "doc-en-react-9306121422e93f6146586d22ff20af2d3e2d2860ed922937e70054809fe064b5", "text": "reported the following issue on IRC: (Both on master and 4.0) The repro case is: 1) Render 2) Render 3) Render the same as 1) The div has its innerHTML empty instead of . I don't really know what's going on. can you guys look at it?\nOne other tidbit: this only seems to happen when the value is exactly the same in step 3 as it was in step 1. If it's different (i.e. ), things work as expected.\nWhat happens if you change step 2 to a instead of a ? It works, right?\nI just reduced the test case to 19 lines.\nyeah changing 2) to use a span works as expected\nIf anyone wants to look into this, the bug is probably here\nI cannot reproduce what you are seeing: It also bugs if I use a different string\nI'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying.\nI know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a property to the React component containing the property. So, does not seem to work reproducibly, whereas seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a statement if that component gets rerendered multiple times with different inner content. Just posting this here in case other people have the same issue and stumble upon this.\nthx you saved my day :-)\nSeems like the issue is back again. Thanks, solves the problem for me too.\nIf any of you can post a simple repro case showing the broken behavior here, I'd be happy to take a look at fixing it.\nTook me a while to repro, but here you go: (ugly, but demonstrates the issue well)\nThanks. This is the same issue as . No fix currently, but using the key as a workaround is fine and I'll see if we can fix this sometime.\nThanks that was giving me fits!\nIf anyone is still seeing issues on 0.14, please make a new issue with a simple repro case.", "commid": "react_issue_377", "tokennum": 469}], "negative_passages": []} | |
| {"query_id": "q-en-react-26b41bf412909ef9599cf66b12f5ea03573f2791da00c76fdc0f5b24e918d007", "query": "_updateDOMChildren: function(lastProps, transaction) { var nextProps = this.props; <del> var lastUsedContent = </del> <ins> var lastContent = </ins> CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; <del> var contentToUse = </del> <ins> var nextContent = </ins> CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; <ins> var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; </ins> // Note the use of `!=` which checks for null or undefined. <ins> var lastChildren = lastContent != null ? null : lastProps.children; var nextChildren = nextContent != null ? null : nextProps.children; </ins> <del> var lastUsedChildren = lastUsedContent != null ? null : lastProps.children; var childrenToUse = contentToUse != null ? null : nextProps.children; </del> <ins> // If we're switching from children to content/html or vice versa, remove // the old content var lastHasContentOrHtml = lastContent != null || lastHtml != null; var nextHasContentOrHtml = nextContent != null || nextHtml != null; if (lastChildren != null && nextChildren == null) { this.updateChildren(null, transaction); } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { this.updateTextContent(''); } </ins> <del> if (contentToUse != null) { var childrenRemoved = lastUsedChildren != null && childrenToUse == null; if (childrenRemoved) { this.updateChildren(null, transaction); } if (lastUsedContent !== contentToUse) { this.updateTextContent('' + contentToUse); </del> <ins> if (nextContent != null) { if (lastContent !== nextContent) { this.updateTextContent('' + nextContent); </ins> } <del> } else { var contentRemoved = lastUsedContent != null && contentToUse == null; if (contentRemoved) { this.updateTextContent(''); </del> <ins> } else if (nextHtml != null) { if (lastHtml !== nextHtml) { ReactComponent.DOMIDOperations.updateInnerHTMLByID( this._rootNodeID, nextHtml ); </ins> } <del> this.updateChildren(flattenChildren(nextProps.children), transaction); </del> <ins> } else if (nextChildren != null) { this.updateChildren(flattenChildren(nextChildren), transaction); </ins> } },", "positive_passages": [{"docid": "doc-en-react-2561d4a0be5f333acf881b6f80c1a973b0d2a5e9e6140ce5d6d62900271a0991", "text": "I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:\nReading out will rarely give you what you put in because the browser does various kinds of normalization on it. If you can repro with a standalone example though I'm happy to take a look.\nwell, that's more like a control shot :-)\nLooks like the issue still exist in 16.4.1 when using on a tag, you cannot nest other or . issue is fixed by replacing the container with a\nIf you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example. when using dangerouslySetInnerHTML on a tag, you cannot nest other or This sounds like browsers work. You can't nest into . This is why React warns when you do it (except in which case React can't validate it).", "commid": "react_issue_377", "tokennum": 312}], "negative_passages": []} | |
| {"query_id": "q-en-react-27a36b8673e4939dd5b59116e8f4a4b80678086077765eec3130a71e4cb034fe", "query": "* @internal */ unmountComponent: function() { <ins> this.unmountChildren(); </ins> ReactEventEmitter.deleteAllListeners(this._rootNodeID); ReactComponent.Mixin.unmountComponent.call(this); <del> this.unmountChildren(); </del> } };", "positive_passages": [{"docid": "doc-en-react-303f5589a27626c8ed5d6f0f930b2b84163d1cdd0133511f0a90007b7a44f4fd", "text": "When unmounting components like this: a memory leak happens because ReactMount.getID(node) puts DOM nodes back to nodeCache if they are not there.. just right after they were purged from cache. Here is what's happing when unmounting that example component: label component gets purged from nodeCache when ReactDOMInput component is going to unmount it calls this method: which contains this.getDOMNode() which iterates through the children of the Form element calling getID() on each of them.. which puts these elements back into the cache. So first they were purged and here they are all put back in cache causing a memory leak :( I'm playing with React just 3rd day so not sure of a way to correctly fix this issue\n(I took the liberty to edit your comment to add syntax highlighting)\nI can't reproduce this. With this diff applied, I loaded http://127.0.0.1:8000/examples/ballmer-peak/ in the console and checked -- it was empty. Am I misunderstanding?\nYes. You've missed one more user defined component in there.. Here you go:\nThanks, fixed in .\nThank you for fast fix :)\nThanks for the find/fix!", "commid": "react_issue_781", "tokennum": 272}], "negative_passages": []} | |
| {"query_id": "q-en-react-280df49022f3b9a5b8664ab787ba9036ef77bc6b23bdf0915351b790454412dc", "query": "</div> <div class=\"fb-like\" data-send=\"true\" data-width=\"650\" data-show-faces=\"false\"></div> <del> <div class=\"fb-comments\" data-width=\"650\" data-num-posts=\"10\" data-href=\"{{ site.url }}{{ site.baseurl }}{{ page.url }}\"></div> </del> </div> </section>", "positive_passages": [{"docid": "doc-en-react-ca64118bf847d4660407dc0cfa80dc13393c771af4b88e26ffe9546e10663249", "text": "Should those comment sections exist? I'd rather people come to IRC. Their questions are often neglected at the bottom of a doc page.\n:+1: for shutting down comments\n+1\n:+1:", "commid": "react_issue_915", "tokennum": 43}], "negative_passages": []} | |
| {"query_id": "q-en-react-29fbe385ed23bd24eba969cbfa4134fdb3f0a5e44d2996e15b64ca57c24a593d", "query": "styleUpdates[styleName] = ''; } } <del> } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { // http://jsperf.com/emptying-speed ReactComponent.DOMIDOperations.updateTextContentByID( this._rootNodeID, '' ); </del> } else if (registrationNames[propKey]) { deleteListener(this._rootNodeID, propKey); <del> } else { </del> <ins> } else if ( DOMProperty.isStandardName[propKey] || DOMProperty.isCustomAttribute(propKey)) { </ins> ReactComponent.DOMIDOperations.deletePropertyByID( this._rootNodeID, propKey", "positive_passages": [{"docid": "doc-en-react-9306121422e93f6146586d22ff20af2d3e2d2860ed922937e70054809fe064b5", "text": "reported the following issue on IRC: (Both on master and 4.0) The repro case is: 1) Render 2) Render 3) Render the same as 1) The div has its innerHTML empty instead of . I don't really know what's going on. can you guys look at it?\nOne other tidbit: this only seems to happen when the value is exactly the same in step 3 as it was in step 1. If it's different (i.e. ), things work as expected.\nWhat happens if you change step 2 to a instead of a ? It works, right?\nI just reduced the test case to 19 lines.\nyeah changing 2) to use a span works as expected\nIf anyone wants to look into this, the bug is probably here\nI cannot reproduce what you are seeing: It also bugs if I use a different string\nI'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying.\nI know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a property to the React component containing the property. So, does not seem to work reproducibly, whereas seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a statement if that component gets rerendered multiple times with different inner content. Just posting this here in case other people have the same issue and stumble upon this.\nthx you saved my day :-)\nSeems like the issue is back again. Thanks, solves the problem for me too.\nIf any of you can post a simple repro case showing the broken behavior here, I'd be happy to take a look at fixing it.\nTook me a while to repro, but here you go: (ugly, but demonstrates the issue well)\nThanks. This is the same issue as . No fix currently, but using the key as a workaround is fine and I'll see if we can fix this sometime.\nThanks that was giving me fits!\nIf anyone is still seeing issues on 0.14, please make a new issue with a simple repro case.", "commid": "react_issue_377", "tokennum": 469}], "negative_passages": []} | |
| {"query_id": "q-en-react-29fbe385ed23bd24eba969cbfa4134fdb3f0a5e44d2996e15b64ca57c24a593d", "query": "styleUpdates[styleName] = ''; } } <del> } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { // http://jsperf.com/emptying-speed ReactComponent.DOMIDOperations.updateTextContentByID( this._rootNodeID, '' ); </del> } else if (registrationNames[propKey]) { deleteListener(this._rootNodeID, propKey); <del> } else { </del> <ins> } else if ( DOMProperty.isStandardName[propKey] || DOMProperty.isCustomAttribute(propKey)) { </ins> ReactComponent.DOMIDOperations.deletePropertyByID( this._rootNodeID, propKey", "positive_passages": [{"docid": "doc-en-react-2561d4a0be5f333acf881b6f80c1a973b0d2a5e9e6140ce5d6d62900271a0991", "text": "I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:\nReading out will rarely give you what you put in because the browser does various kinds of normalization on it. If you can repro with a standalone example though I'm happy to take a look.\nwell, that's more like a control shot :-)\nLooks like the issue still exist in 16.4.1 when using on a tag, you cannot nest other or . issue is fixed by replacing the container with a\nIf you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example. when using dangerouslySetInnerHTML on a tag, you cannot nest other or This sounds like browsers work. You can't nest into . This is why React warns when you do it (except in which case React can't validate it).", "commid": "react_issue_377", "tokennum": 312}], "negative_passages": []} | |
| {"query_id": "q-en-react-2eeacd7fbbe10d84d6676db603ec3a4e8b8a8e27651d68200a25831975903454", "query": "case topLevelTypes.topDoubleClick: case topLevelTypes.topMouseDown: case topLevelTypes.topMouseMove: <ins> case topLevelTypes.topMouseOut: case topLevelTypes.topMouseOver: </ins> case topLevelTypes.topMouseUp: EventConstructor = SyntheticMouseEvent; break;", "positive_passages": [{"docid": "doc-en-react-7e215142cfee41f3a5c9f3a4523ae6786642b4cde53fcef8da4414036dde1206", "text": "Someone had the trouble in IRC about it. Edit: changed the subject from \"document it\" to \"support it\", because the documentation issue is already at .\nBetter yet, support it!\nYeah, is there a particular reason it's not supported?\nCurious if you've seen the . It's automatically injected into React by default, so you can use it today. IMHO it's (much) better than . (I suppose we could support just for the sake of completeness, but I thought I'd just make sure you guys were aware of .)\nWe discussed this for a bit on IRC -- was just confused that silently didn't work whereas other events did -- perhaps adding more documentation () will fix the problem too but it seems like we might as well add for completeness. (I agree that enter/leave are much more useful and suggested that over/out are likely missing simply because no one has needed them!)\nAgree - I believe there are a few extra allocations (not-pooled) occuring in the event system already today. I'd love to track those down before adding more mouse-move event allocations. If you open the memory profiler in Chrome and move the mouse around, you'll see memory being allocated (and then properly freed of course) but if we use es everywhere, we should be flat. That would make me much more comfortable with adding to . Edit: Just checked out - we already have which fires way more frequently than would so it's probably not such a big deal to add - though we really should get rid of all additional allocations in the event path.\nJust started to look a little bit into the allocations here. Redefining trapBubbledEvent in ReactEventEmitter with: still shows allocations in the Chrome memory timeline view, so I'm not convinced that there's anything we can do here? (Replacing trapBubbledEvent itself with a noop makes the allocations go away. simply calls addEventListener.)\nI am pretty sure we have done all we can here -- at least I think we've tracked down every callsite where PooledClass would have helped us. I updated our recast transforms to log every syntax construct that would cause an obvious allocation and couldn't find anything. I was thinking maybe there was an array slice or a bind() in there, but experiment shows that this is not the case.", "commid": "react_issue_340", "tokennum": 509}], "negative_passages": []} | |
| {"query_id": "q-en-react-2eeacd7fbbe10d84d6676db603ec3a4e8b8a8e27651d68200a25831975903454", "query": "case topLevelTypes.topDoubleClick: case topLevelTypes.topMouseDown: case topLevelTypes.topMouseMove: <ins> case topLevelTypes.topMouseOut: case topLevelTypes.topMouseOver: </ins> case topLevelTypes.topMouseUp: EventConstructor = SyntheticMouseEvent; break;", "positive_passages": [{"docid": "doc-en-react-ac434d767083ac836e19c967390cf16739cdb96c2a1d7993c7c103db6b357686", "text": "(I didn't verify that we don't have more allocations than the empty-function case; I don't know of a good way to do so.)\nI might be misinformed, but isn't there quite a difference in use cases between mouseenter and mouseover events? Here's a theoretical (non-react) example working with some hover states for nested elements: I tried to apply the above concept in react (with nested components) using onMouseEnter instead, but it obviously fails because it's only triggered once on the top-most element. Moving into a child element and back has no effect. Maybe there's a better approach for this in react altogether?\nIf you render the child hierarchy with React, you can listen to on each child element you are interested in instead of using event bubbling. It is cheap.", "commid": "react_issue_340", "tokennum": 179}], "negative_passages": []} | |
| {"query_id": "q-en-react-33a20264932ebe0d8a0c6b4086d548e615657866094922ff3bd259176ca4faf1", "query": "); } <del> // stub element used by act() when flushing effects let actContainerElement = document.createElement('div'); </del> <ins> // a stub element, lazily initialized, used by act() when flushing effects let actContainerElement = null; </ins> /** * Utilities for making it easy to test React components.", "positive_passages": [{"docid": "doc-en-react-7f71b422a7c46807c8ad6800cb40555b1545b6633c633ac24a28676df53b6fa9", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug. Behavior regression. What is the current behavior? Package throws when being required in Node. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: What is the expected behavior? should not throw in \"pure\" node (without providing fake document on global). Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? happens on 16.8.0 previous versions work.\nWe also got this issue after upgrading to 16.8.0\nFound the fix and putting together a PR now edit: now on the case", "commid": "react_issue_14764", "tokennum": 210}], "negative_passages": []} | |
| {"query_id": "q-en-react-348ef8bbc28f8eabef2ac31ce644cb91080b17dfb8027e3b25eb47a560e52645", "query": "html: createFullPageComponent(ReactDOM.html), head: createFullPageComponent(ReactDOM.head), <del> title: createFullPageComponent(ReactDOM.title), </del> body: createFullPageComponent(ReactDOM.body) });", "positive_passages": [{"docid": "doc-en-react-3c4f9d785f1f0c21776dcf45a4d8b42a00aa90af6d304d44f542c6fa5266b716", "text": "Here's an example at jsbin: Clicking for the first time works (mounts a SVG +), but when clicking the same button again (which should unmount the rect+title), react throws an exception. I have no clue how to get around this. Help is very much appreciated. Thanks in advance!\nAh, this is because React doesn't let you unmount the HTML element. I don't believe there's a workaround right now, sorry. cc\nFixed by .", "commid": "react_issue_1376", "tokennum": 105}], "negative_passages": []} | |
| {"query_id": "q-en-react-353ff7a4364db19ff636be9f37ad8345e0c1e3c60efd30121dd4dad293dfb88b", "query": "expect(stub.getDOMNode().innerHTML).toEqual(''); }); <ins> it(\"should transition from string content to innerHTML\", function() { var stub = ReactTestUtils.renderIntoDocument( <div>hello</div> ); expect(stub.getDOMNode().innerHTML).toEqual('hello'); stub.receiveProps( {dangerouslySetInnerHTML: {__html: 'goodbye'}}, transaction ); expect(stub.getDOMNode().innerHTML).toEqual('goodbye'); }); it(\"should transition from innerHTML to string content\", function() { var stub = ReactTestUtils.renderIntoDocument( <div dangerouslySetInnerHTML={{__html: 'bonjour'}} /> ); expect(stub.getDOMNode().innerHTML).toEqual('bonjour'); stub.receiveProps({children: 'adieu'}, transaction); expect(stub.getDOMNode().innerHTML).toEqual('adieu'); }); </ins> it(\"should not incur unnecessary DOM mutations\", function() { var stub = ReactTestUtils.renderIntoDocument(<div value=\"\" />);", "positive_passages": [{"docid": "doc-en-react-9306121422e93f6146586d22ff20af2d3e2d2860ed922937e70054809fe064b5", "text": "reported the following issue on IRC: (Both on master and 4.0) The repro case is: 1) Render 2) Render 3) Render the same as 1) The div has its innerHTML empty instead of . I don't really know what's going on. can you guys look at it?\nOne other tidbit: this only seems to happen when the value is exactly the same in step 3 as it was in step 1. If it's different (i.e. ), things work as expected.\nWhat happens if you change step 2 to a instead of a ? It works, right?\nI just reduced the test case to 19 lines.\nyeah changing 2) to use a span works as expected\nIf anyone wants to look into this, the bug is probably here\nI cannot reproduce what you are seeing: It also bugs if I use a different string\nI'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying.\nI know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a property to the React component containing the property. So, does not seem to work reproducibly, whereas seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a statement if that component gets rerendered multiple times with different inner content. Just posting this here in case other people have the same issue and stumble upon this.\nthx you saved my day :-)\nSeems like the issue is back again. Thanks, solves the problem for me too.\nIf any of you can post a simple repro case showing the broken behavior here, I'd be happy to take a look at fixing it.\nTook me a while to repro, but here you go: (ugly, but demonstrates the issue well)\nThanks. This is the same issue as . No fix currently, but using the key as a workaround is fine and I'll see if we can fix this sometime.\nThanks that was giving me fits!\nIf anyone is still seeing issues on 0.14, please make a new issue with a simple repro case.", "commid": "react_issue_377", "tokennum": 469}], "negative_passages": []} | |
| {"query_id": "q-en-react-353ff7a4364db19ff636be9f37ad8345e0c1e3c60efd30121dd4dad293dfb88b", "query": "expect(stub.getDOMNode().innerHTML).toEqual(''); }); <ins> it(\"should transition from string content to innerHTML\", function() { var stub = ReactTestUtils.renderIntoDocument( <div>hello</div> ); expect(stub.getDOMNode().innerHTML).toEqual('hello'); stub.receiveProps( {dangerouslySetInnerHTML: {__html: 'goodbye'}}, transaction ); expect(stub.getDOMNode().innerHTML).toEqual('goodbye'); }); it(\"should transition from innerHTML to string content\", function() { var stub = ReactTestUtils.renderIntoDocument( <div dangerouslySetInnerHTML={{__html: 'bonjour'}} /> ); expect(stub.getDOMNode().innerHTML).toEqual('bonjour'); stub.receiveProps({children: 'adieu'}, transaction); expect(stub.getDOMNode().innerHTML).toEqual('adieu'); }); </ins> it(\"should not incur unnecessary DOM mutations\", function() { var stub = ReactTestUtils.renderIntoDocument(<div value=\"\" />);", "positive_passages": [{"docid": "doc-en-react-2561d4a0be5f333acf881b6f80c1a973b0d2a5e9e6140ce5d6d62900271a0991", "text": "I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:\nReading out will rarely give you what you put in because the browser does various kinds of normalization on it. If you can repro with a standalone example though I'm happy to take a look.\nwell, that's more like a control shot :-)\nLooks like the issue still exist in 16.4.1 when using on a tag, you cannot nest other or . issue is fixed by replacing the container with a\nIf you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example. when using dangerouslySetInnerHTML on a tag, you cannot nest other or This sounds like browsers work. You can't nest into . This is why React warns when you do it (except in which case React can't validate it).", "commid": "react_issue_377", "tokennum": 312}], "negative_passages": []} | |
| {"query_id": "q-en-react-3960063a2216545d93697ac670de471b5fa68e2314de7dc297b474e9147e36ce", "query": "SimulateNative: {}, act(callback: () => void): Thenable { <ins> if (actContainerElement === null) { // warn if we can't actually create the stub element if (__DEV__) { warningWithoutStack( typeof document !== 'undefined' && document !== null && typeof document.createElement === 'function', 'It looks like you called TestUtils.act(...) in a non-browser environment. ' + \"If you're using TestRenderer for your tests, you should call \" + 'TestRenderer.act(...) instead of TestUtils.act(...).', ); } // then make it actContainerElement = document.createElement('div'); } const result = ReactDOM.unstable_batchedUpdates(callback); </ins> // note: keep these warning messages in sync with // createReactNoop.js and ReactTestRenderer.js <del> const result = ReactDOM.unstable_batchedUpdates(callback); </del> if (__DEV__) { if (result !== undefined) { let addendum;", "positive_passages": [{"docid": "doc-en-react-7f71b422a7c46807c8ad6800cb40555b1545b6633c633ac24a28676df53b6fa9", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug. Behavior regression. What is the current behavior? Package throws when being required in Node. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: What is the expected behavior? should not throw in \"pure\" node (without providing fake document on global). Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? happens on 16.8.0 previous versions work.\nWe also got this issue after upgrading to 16.8.0\nFound the fix and putting together a PR now edit: now on the case", "commid": "react_issue_14764", "tokennum": 210}], "negative_passages": []} | |
| {"query_id": "q-en-react-3ad52d7c459f4a0e4a6a2c2e5a5974c6a8b9709818b342eaf6a7231e8f735047", "query": "reactComponentExpect = require('reactComponentExpect'); React = require('React'); <ins> ReactComponent = require('ReactComponent'); </ins> ReactCurrentOwner = require('ReactCurrentOwner'); ReactDoNotBindDeprecated = require('ReactDoNotBindDeprecated'); ReactPropTypes = require('ReactPropTypes');", "positive_passages": [{"docid": "doc-en-react-303f5589a27626c8ed5d6f0f930b2b84163d1cdd0133511f0a90007b7a44f4fd", "text": "When unmounting components like this: a memory leak happens because ReactMount.getID(node) puts DOM nodes back to nodeCache if they are not there.. just right after they were purged from cache. Here is what's happing when unmounting that example component: label component gets purged from nodeCache when ReactDOMInput component is going to unmount it calls this method: which contains this.getDOMNode() which iterates through the children of the Form element calling getID() on each of them.. which puts these elements back into the cache. So first they were purged and here they are all put back in cache causing a memory leak :( I'm playing with React just 3rd day so not sure of a way to correctly fix this issue\n(I took the liberty to edit your comment to add syntax highlighting)\nI can't reproduce this. With this diff applied, I loaded http://127.0.0.1:8000/examples/ballmer-peak/ in the console and checked -- it was empty. Am I misunderstanding?\nYes. You've missed one more user defined component in there.. Here you go:\nThanks, fixed in .\nThank you for fast fix :)\nThanks for the find/fix!", "commid": "react_issue_781", "tokennum": 272}], "negative_passages": []} | |
| {"query_id": "q-en-react-44b109529c17da3a51894951913509ba4cf0770160044dff97cdc6a134640782", "query": "cellPadding: null, cellSpacing: null, charSet: MUST_USE_ATTRIBUTE, <ins> challenge: MUST_USE_ATTRIBUTE, </ins> checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, classID: MUST_USE_ATTRIBUTE, // To set className on SVG elements, it's necessary to use .setAttribute;", "positive_passages": [{"docid": "doc-en-react-c106a437ddd3bd1957c6502f10dcab059cffc9005b0db8685ba1254d6e535341", "text": "I'm using tag to generate client certificates and I'm missing challenge and keytype attributes.\nIt would be cool if React gives us the opportunity to use different syntax for attrs and props: And may be: There would be no need to know what tags React supporting.\nThere's more planned to alleviate the issues around unknown elements and properties, but we're not there yet. We have no plans on to use different syntax. Adding the additional attributes here seems totally reasonable.\nWill try to take a stab at this. I assume this is as simple as adding those props to , and then adding tests. Is that correct or am I missing anything significant?\nIt's even easier than that since we don't really have tests for the attributes. But do actually test in a couple browsers that changing values across renders is reflected appropriately (usually the issues is property vs attribute).\nYou're quick, guys. Thanks in advance!\nBy 'across renders' you mean simply triggering a re-render (by changing the value)?\nYea. I usually just make a simple component with a button that toggles state so I can test with multiple values easily.\nGreat. Thx.\nI missed a detail in docs. Although, I don't need it, there's an additional attribute, keyparams, which is required with \"dsa\" and \"ec\" keytypes. See\nHave this working, though I'm not entirely clear if these should be , or . I wasn't able to deduce the meaning of these from the code. Is there someplace I can read up on these?\nThose are used to determine if we do or if we do when updating. means it doesn't matter and browsers should work with either. Currently we use properties in that case but we may switch that in the future. indicate that they must be set & removed as a property or an attribute.\nThanks. That makes sense. Had to use to get it to work properly across Chrome/FF/Safari. Your testing method great as well. Thx for your help", "commid": "react_issue_3961", "tokennum": 430}], "negative_passages": []} | |
| {"query_id": "q-en-react-468f3449a0008c818d29505a774383a2010ab4a9cedc64dba144f8d434803ea9", "query": "ReactCurrentOwner.current = this; var inst = this._instance; try { <del> renderedComponent = inst.render(); if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. renderedComponent = null; } } </del> <ins> renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); </ins> } finally { ReactContext.current = previousContext; ReactCurrentOwner.current = null;", "positive_passages": [{"docid": "doc-en-react-43bd8c935fcf00bee8061fadc9d53ee4ce08d7674cd1b756a95fad46456d6e25", "text": "We need a way to test the output of a single level React component without resolving it all the way down to the bottom layer (whatever that is). I'm thinking something like this: Basically, this fix needs to go through the entire life-cycle of ReactCompositeComponent. It just needs to bail out whenever it would've continued rendering.\nReopened so that we can track the remaining features (refs etc.)\nWeird, I thought GitHub only closed issues if you used language like \"fixes #NNNN\", not if you simply mentioned the issue at all. Sorry about that.\nThe PR text included \"WIP to \"\nIs the rest (refs support) blocked by or can more work be done now?\nAny reason this doesn't support other than that it's not implemented yet? I was hoping to do something like\nthat's supposed to work. Can you post a minimal repro?\nHow do you do this? does not return an instance.\nIt works if I use so I think could just return that from . (I also have to shim because React expects it to be defined for some reason.)\nFinding this quite useful. But it has been a bit inconvenient to have among the children when an element is conditionally rendered.\nThe idea was to make the helpers ignore null which could help with that. Perhaps we could have return an iterable which traverses nested arrays and ignores null.\nReally? Allowing nulls was a change intentionally introduced a long time ago. In I have an implementation of toArray.\nAllowing empty children (null, undefined, boolean) was a controversial topic, where we eventually landed on null/boolean/undefined being passed through. That way you could explicitly treat an empty slot as something special. This landed very early on before we really started seeing pattern developing. However, IMO, we've seen that this leads to inconsistent implementations where null slots will break and is not possible to use. It is unclear whether a set of children allows nullable slots, and if they do, it is unclear what that means. For example, in a grid layout component, does an empty slot mean that there should be an empty column in the grid, or that it should be skipped? Therefore, a lot of our components end up with explicit null checks. Meaning boilerplate, and inconsistent behavior when they're forgotten.", "commid": "react_issue_2393", "tokennum": 498}], "negative_passages": []} | |
| {"query_id": "q-en-react-468f3449a0008c818d29505a774383a2010ab4a9cedc64dba144f8d434803ea9", "query": "ReactCurrentOwner.current = this; var inst = this._instance; try { <del> renderedComponent = inst.render(); if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. renderedComponent = null; } } </del> <ins> renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); </ins> } finally { ReactContext.current = previousContext; ReactCurrentOwner.current = null;", "positive_passages": [{"docid": "doc-en-react-26f74882fe59ad2106ea606628fef442808db170983d47929460fee2f487ed92", "text": "Therefore, I think the default should be to filter out nulls which is consistent with the behavior of the built-ins components. It is still possible to get access to the raw data if you have a different type of children in mind where empty slots is meaningful.\nHow should this work with the TestUtils functions. For example, this fails: I can't see any other info on mentioned at the start of this issue, is this what I'm missing? My end goal is simply to test that if I pass in 10 articles then 10 components get rendered. Any help would be awesome.\nHi David, the and functions are meant to be used with the output of , not shallow rendering. React doesn't currently provide a helper that will traverse trees for you. Your options for now are to describe the structure of the tree explicitly as in lines 4-5 of your example, or write your own helper module to find descendants you care about. hasn't been implemented yet. Refer to the for what's actually in React.\nCool, thanks for the reply I've returned to just using since the components I'm testing (and their children) don't have state/stores so don't really need mocking out anyway. One last (maybe stupid) question, what does mean?\nSo, I am trying to use Shallow Rendering and have it mostly only thing left I can\u2019t figure out is the recommended way to mock events and how to get with events to pass. I've attempted to use the method directly from the in the test (). This seems dirty\u2026is there a way to just say or something? I could post this on Stack Overflow, but I have had very little luck finding good information about Shallow Rendering online. If anyone has experience with shallow rendering and can give me some help you will be my hero... Source code: ! !\nIf I have an issue with shallow rendering, should I create a new issue, or post it here?\nNew issue please.\nyou might find that helps in providing higher-level assertions for the sort of thing you're doing there. In that particular case, I would avoid asserting on the event handler of the anchor in that test - but a different test would want to call to test the handler.\nSuper late reply, but \"scry\" is a fancy word for \"find\". I'm not sure why we don't just use \"find\".", "commid": "react_issue_2393", "tokennum": 500}], "negative_passages": []} | |
| {"query_id": "q-en-react-468f3449a0008c818d29505a774383a2010ab4a9cedc64dba144f8d434803ea9", "query": "ReactCurrentOwner.current = this; var inst = this._instance; try { <del> renderedComponent = inst.render(); if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. renderedComponent = null; } } </del> <ins> renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); </ins> } finally { ReactContext.current = previousContext; ReactCurrentOwner.current = null;", "positive_passages": [{"docid": "doc-en-react-74686185b37a0ea269ae4ac6ffd7ebf8062f5d897e5d70eb2610fd72d3a71db1", "text": "Maybe to avoid confusion between the plural and singular forms, whose names would otherwise differ only by one \"s\".\nscry is because of legacy internal FB APIs. No reason.\nLike I'm keenly on the lookout for a way to correctly unit test event handling in React code. Is there any documentation that anyone could point me to? I've looked at but it didn't seem to have something that scratches my particular itch. Here's my scenario (cut down): Where Problem looks like this: I'd like to be able to assert that is wired up for my component but I'm at a loss as to how to do that....\nWhat you actually want is to assert that clicking interacts with the router. Pass in a fake context with a router mock (try Simon) then call Apologies for the brevity, on a phone.\nHi Thanks for responding. I'm not too clear on how to mock successfully when it comes to context. Digging through the source of I came up with this: However this dies a death with: Which makes me think I'm getting the context mocking wrong. Do you know how you successfully mock context with ? I'm using Jasmine (as you probably guessed!) I have a feeling I'm close...\nAre you using React 0.13? You're probably hitting the difference between parent & owner context. Skin deep has a wrapper that helps with this - there's a context example the test suite, but the short answer is to wrap your render in another function call and let skin deep set up the context. This problem should go away in 0.14\nI am using React 0.13, yes. If I port to 0.14 this issue should resolve? I might give that a crack if that's the case (it is in RC after all)\nProblems with the upgrade. I have raised . Will have to return to this later I think.\nI have written and as companion tools when testing with shallow rendering. It gives you the ability to diff on JSX strings rendered instead of React element objects.\nHi, I was wondering what was the state of: simulating events when using shallow rendering using refs when using shallow rendering How can we help make this happen if that's still planned?\nThis issue is pretty stale so I\u2019ll close it.", "commid": "react_issue_2393", "tokennum": 488}], "negative_passages": []} | |
| {"query_id": "q-en-react-468f3449a0008c818d29505a774383a2010ab4a9cedc64dba144f8d434803ea9", "query": "ReactCurrentOwner.current = this; var inst = this._instance; try { <del> renderedComponent = inst.render(); if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. renderedComponent = null; } } </del> <ins> renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); </ins> } finally { ReactContext.current = previousContext; ReactCurrentOwner.current = null;", "positive_passages": [{"docid": "doc-en-react-648b97e94c725256b26e1bd96a5fd371b8015ffce2e3e1a0a44a2263c4489568", "text": "If there are specific features you miss in the shallow renderer please create new issues with proposals on how they should work. Note that we a new that is much more feature-complete.", "commid": "react_issue_2393", "tokennum": 37}], "negative_passages": []} | |
| {"query_id": "q-en-react-4734459bb16532eb5aafa8f3bbb5dd04693fbfbd22abcd7e1fb13c89b20cc667", "query": "urls.unshift('../node_modules/es5-shim/es5-shim.js'); } <del> var cacheBust = '?_=' + Date.now().toString(36); </del> <ins> var cacheBust = '?_=' + (+new Date).toString(36); </ins> for (var urls_index = -1, urls_length = urls.length; ++urls_index < urls_length;) { document.write('<script src=\"' + urls[urls_index] + cacheBust + '\"></script>');", "positive_passages": [{"docid": "doc-en-react-ab535627950c5c4f6788fdc21c9855588e086629d351666b24466bad463969c7", "text": "Nor sure what that means other than that the tests are flakey :'(\nhttps://travis-\nhttps://travis-", "commid": "react_issue_634", "tokennum": 29}], "negative_passages": []} | |
| {"query_id": "q-en-react-498560f2b171c7edbbf8619146ff8cc1b5bbdecccefa1dfbdce3ef14e872e74f", "query": "static .grunt _SpecRunner.html <ins> __benchmarks__ </ins> build/ .module-cache *.gem", "positive_passages": [{"docid": "doc-en-react-420230a6465b37906f76850a9ad9d8a7e4830d1f7a738b4b1e69fb61d7b63fd7", "text": "I am using a few react components made by various libraries like material ui and i get this message on doing i can see only one version of react installed. I am using gulp and browserify for my build process. Any idea how i can solve this?\nI've found this is common when modules have React as a dependency rather than a peerDependency in the npm package. If you're using webpack, I've got around this by creating an alias, perhaps you can do something similar in Gulp.\nAwesome that helped.. Just sharing some ref for others Thanks.\nAlso please file issues in such libraries and gently ask them to use for instead .\nFor those who do not want to install any other packages for resolving. Configure a require key in the browserify object and that will take care of the error", "commid": "react_issue_8026", "tokennum": 170}], "negative_passages": []} | |
| {"query_id": "q-en-react-49987896124250b1ee8db135cc5d7acde06a25b7c00554b3b6e4ea0fce834e84", "query": "asap \"~2.0.3\" prop-types@^15.5.8: <del> version \"15.5.8\" resolved \"https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.8.tgz#6b7b2e141083be38c8595aa51fc55775c7199394\" </del> <ins> version \"15.5.10\" resolved \"https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154\" </ins> dependencies: fbjs \"^0.8.9\" <ins> loose-envify \"^1.3.1\" </ins> prr@~0.0.0: version \"0.0.0\"", "positive_passages": [{"docid": "doc-en-react-e3a52dd5c509e0b69abfb1882d7c573a3a80737013a0b6115656ad61a05c4ff5", "text": "Check that they were a part of the latest internal sync. For stable releases, prefer that they\u2019ve been landed for a week or so. Only skip this step if you really know what you\u2019re doing! [x] You\u2019re in [x] You\u2019re in [x] You\u2019re in [x] You\u2019re in If not, ping someone on the team![x] Ensure you\u2019re on [x] Do a . [x] Check that your local output matches the commit list. [x] Run in the repo root.[x] For : [x] Look at the version range of in root . [x] Ensure all depending on specify the same range. [x] Run in the repo root. (Don\u2019t miss the caret!) [x] For : [x] Look at the version range of in root . [x] Ensure all depending on specify the same range. [x] Run in the repo root. (Don\u2019t miss the caret!) [x] For : [x] Look at the version range of in root . [x] Ensure all depending on specify the same range. [x] Run in the repo root. (Don\u2019t miss the caret!) [x] This might change the lockfile. This should not change any . [x] Commit the changes, if any. (see )[x] Edit: is broken in the 16 branch but this shouldn't block RC, and will be fixed asap by and in [x] Run in the repo root. [x] Run in the repo root. [x] Run in the repo root.[x] Run in the repo root. [x] If changes, [x] Maybe: If we still have a separate branch for docs when you\u2019re reading this, we need to cherry-pick that commit to that branch. This makes sure the website decoder knows about the updated error codes. But ideally we should just change docs to serve from master. (See and ) [x] Update export in [x] Update in all : [x] [x] [x] [x] [x] If you see any other packages, update this list :-) [x] Run to verify your changes. [x][x] Run in the repo root.[x] Open in the browser for a smoke test.", "commid": "react_issue_10623", "tokennum": 508}], "negative_passages": []} | |
| {"query_id": "q-en-react-49987896124250b1ee8db135cc5d7acde06a25b7c00554b3b6e4ea0fce834e84", "query": "asap \"~2.0.3\" prop-types@^15.5.8: <del> version \"15.5.8\" resolved \"https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.8.tgz#6b7b2e141083be38c8595aa51fc55775c7199394\" </del> <ins> version \"15.5.10\" resolved \"https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154\" </ins> dependencies: fbjs \"^0.8.9\" <ins> loose-envify \"^1.3.1\" </ins> prr@~0.0.0: version \"0.0.0\"", "positive_passages": [{"docid": "doc-en-react-29ef57184113a6fc6d83b3b0327ea1e1ef0ba8b29aaee91d2e5434d12686c6b0", "text": "[x] It should say \u201cHello world!\u201d[x] Go to and run [x] [x] Go to the repo root and run [x] Open http://localhost:5000/fixtures/packaging/ and verify every iframe shows \u201cHello World!\u201d[x] Run [x] Run [x] Go to [x] For every subfolder: [x] For non-stable versions: Run in the subfolder. [x] For stable versions: Run in the subfolder.[ ] [ ] [ ]\nw00t~", "commid": "react_issue_10623", "tokennum": 124}], "negative_passages": []} | |
| {"query_id": "q-en-react-4c90c9a926583776dbf8862db3d9de83b74f66680db5e7771d33354fe9f578ab", "query": "this._updater, ); <del> this._updateStateFromStaticLifecycle(element.props); </del> <ins> if (typeof element.type.getDerivedStateFromProps === 'function') { const partialState = element.type.getDerivedStateFromProps.call( null, element.props, this._instance.state, ); if (partialState != null) { this._instance.state = Object.assign( {}, this._instance.state, partialState, ); } } </ins> if (element.type.hasOwnProperty('contextTypes')) { currentlyValidatingElement = element;", "positive_passages": [{"docid": "doc-en-react-af6422597abfc3705e1e016cf37e5dbfbfdcf0923b24267ad3eb49d20f8d6064", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug What is the current behavior? In , the shallow renderer will set instance state in so the and will be the same in , which is different with the behavior of real rendering. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: given below class component: render with ReactDOM, the will return true since will be the old value : In shallow renderer, the behavior is different: What is the expected behavior? ShallowRenderer should not set the instance state in getDeriveStateFromProps, or in the we have no way to compare it. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? I have tested this in master branch and 16.3, both not work. By the way this problem is related to airbnb/enzyme . If it's recoginzed as a bug I can provide a PR in next several days.", "commid": "react_issue_14607", "tokennum": 285}], "negative_passages": []} | |
| {"query_id": "q-en-react-4e8e1565bb1cace3befc7dcda3adf7df21abaaeada18815a999f4f6f20de67b9", "query": "}); <ins> var ShallowMixin = assign({}, ReactCompositeComponentMixin, { /** * Initializes the component, renders markup, and registers event listeners. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @param {number} mountDepth number of components in the owner hierarchy * @return {ReactElement} Shallow rendering of the component. * @final * @internal */ mountComponent: function(rootID, transaction, mountDepth) { ReactComponent.Mixin.mountComponent.call( this, rootID, transaction, mountDepth ); var inst = this._instance; // Store a reference from the instance back to the internal representation ReactInstanceMap.set(inst, this); this._compositeLifeCycleState = CompositeLifeCycle.MOUNTING; // No context for shallow-mounted components. inst.props = this._processProps(this._currentElement.props); var initialState = inst.getInitialState ? inst.getInitialState() : null; if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof initialState === 'undefined' && inst.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } invariant( typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', inst.constructor.displayName || 'ReactCompositeComponent' ); inst.state = initialState; this._pendingState = null; this._pendingForceUpdate = false; if (inst.componentWillMount) { inst.componentWillMount(); // When mounting, calls to `setState` by `componentWillMount` will set // `this._pendingState` without triggering a re-render. if (this._pendingState) { inst.state = this._pendingState; this._pendingState = null; } } // No recursive call to instantiateReactComponent for shallow rendering. this._renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); // Done with mounting, `setState` will now trigger UI changes. this._compositeLifeCycleState = null; // No call to this._renderedComponent.mountComponent for shallow // rendering. if (inst.componentDidMount) { transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); } return this._renderedComponent; }, /** * Call the component's `render` method and update the DOM accordingly. * * @param {ReactReconcileTransaction} transaction * @internal */ _updateRenderedComponent: function(transaction) { var prevComponentInstance = this._renderedComponent; var prevRenderedElement = prevComponentInstance._currentElement; // Use the without-owner-or-context variant of _rVC below: var nextRenderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { prevComponentInstance.receiveComponent( nextRenderedElement, transaction ); } else { // These two IDs are actually the same! But nothing should rely on that. var thisID = this._rootNodeID; var prevComponentID = prevComponentInstance._rootNodeID; // Don't unmount previous instance since it was never mounted, due to // shallow render. //prevComponentInstance.unmountComponent(); this._renderedComponent = nextRenderedElement; // ^ no instantiateReactComponent // // no recursive mountComponent return nextRenderedElement; } } }); </ins> var ReactCompositeComponent = { LifeCycle: CompositeLifeCycle, <del> Mixin: ReactCompositeComponentMixin </del> <ins> Mixin: ReactCompositeComponentMixin, ShallowMixin: ShallowMixin </ins> };", "positive_passages": [{"docid": "doc-en-react-43bd8c935fcf00bee8061fadc9d53ee4ce08d7674cd1b756a95fad46456d6e25", "text": "We need a way to test the output of a single level React component without resolving it all the way down to the bottom layer (whatever that is). I'm thinking something like this: Basically, this fix needs to go through the entire life-cycle of ReactCompositeComponent. It just needs to bail out whenever it would've continued rendering.\nReopened so that we can track the remaining features (refs etc.)\nWeird, I thought GitHub only closed issues if you used language like \"fixes #NNNN\", not if you simply mentioned the issue at all. Sorry about that.\nThe PR text included \"WIP to \"\nIs the rest (refs support) blocked by or can more work be done now?\nAny reason this doesn't support other than that it's not implemented yet? I was hoping to do something like\nthat's supposed to work. Can you post a minimal repro?\nHow do you do this? does not return an instance.\nIt works if I use so I think could just return that from . (I also have to shim because React expects it to be defined for some reason.)\nFinding this quite useful. But it has been a bit inconvenient to have among the children when an element is conditionally rendered.\nThe idea was to make the helpers ignore null which could help with that. Perhaps we could have return an iterable which traverses nested arrays and ignores null.\nReally? Allowing nulls was a change intentionally introduced a long time ago. In I have an implementation of toArray.\nAllowing empty children (null, undefined, boolean) was a controversial topic, where we eventually landed on null/boolean/undefined being passed through. That way you could explicitly treat an empty slot as something special. This landed very early on before we really started seeing pattern developing. However, IMO, we've seen that this leads to inconsistent implementations where null slots will break and is not possible to use. It is unclear whether a set of children allows nullable slots, and if they do, it is unclear what that means. For example, in a grid layout component, does an empty slot mean that there should be an empty column in the grid, or that it should be skipped? Therefore, a lot of our components end up with explicit null checks. Meaning boilerplate, and inconsistent behavior when they're forgotten.", "commid": "react_issue_2393", "tokennum": 498}], "negative_passages": []} | |
| {"query_id": "q-en-react-4e8e1565bb1cace3befc7dcda3adf7df21abaaeada18815a999f4f6f20de67b9", "query": "}); <ins> var ShallowMixin = assign({}, ReactCompositeComponentMixin, { /** * Initializes the component, renders markup, and registers event listeners. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @param {number} mountDepth number of components in the owner hierarchy * @return {ReactElement} Shallow rendering of the component. * @final * @internal */ mountComponent: function(rootID, transaction, mountDepth) { ReactComponent.Mixin.mountComponent.call( this, rootID, transaction, mountDepth ); var inst = this._instance; // Store a reference from the instance back to the internal representation ReactInstanceMap.set(inst, this); this._compositeLifeCycleState = CompositeLifeCycle.MOUNTING; // No context for shallow-mounted components. inst.props = this._processProps(this._currentElement.props); var initialState = inst.getInitialState ? inst.getInitialState() : null; if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof initialState === 'undefined' && inst.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } invariant( typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', inst.constructor.displayName || 'ReactCompositeComponent' ); inst.state = initialState; this._pendingState = null; this._pendingForceUpdate = false; if (inst.componentWillMount) { inst.componentWillMount(); // When mounting, calls to `setState` by `componentWillMount` will set // `this._pendingState` without triggering a re-render. if (this._pendingState) { inst.state = this._pendingState; this._pendingState = null; } } // No recursive call to instantiateReactComponent for shallow rendering. this._renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); // Done with mounting, `setState` will now trigger UI changes. this._compositeLifeCycleState = null; // No call to this._renderedComponent.mountComponent for shallow // rendering. if (inst.componentDidMount) { transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); } return this._renderedComponent; }, /** * Call the component's `render` method and update the DOM accordingly. * * @param {ReactReconcileTransaction} transaction * @internal */ _updateRenderedComponent: function(transaction) { var prevComponentInstance = this._renderedComponent; var prevRenderedElement = prevComponentInstance._currentElement; // Use the without-owner-or-context variant of _rVC below: var nextRenderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { prevComponentInstance.receiveComponent( nextRenderedElement, transaction ); } else { // These two IDs are actually the same! But nothing should rely on that. var thisID = this._rootNodeID; var prevComponentID = prevComponentInstance._rootNodeID; // Don't unmount previous instance since it was never mounted, due to // shallow render. //prevComponentInstance.unmountComponent(); this._renderedComponent = nextRenderedElement; // ^ no instantiateReactComponent // // no recursive mountComponent return nextRenderedElement; } } }); </ins> var ReactCompositeComponent = { LifeCycle: CompositeLifeCycle, <del> Mixin: ReactCompositeComponentMixin </del> <ins> Mixin: ReactCompositeComponentMixin, ShallowMixin: ShallowMixin </ins> };", "positive_passages": [{"docid": "doc-en-react-26f74882fe59ad2106ea606628fef442808db170983d47929460fee2f487ed92", "text": "Therefore, I think the default should be to filter out nulls which is consistent with the behavior of the built-ins components. It is still possible to get access to the raw data if you have a different type of children in mind where empty slots is meaningful.\nHow should this work with the TestUtils functions. For example, this fails: I can't see any other info on mentioned at the start of this issue, is this what I'm missing? My end goal is simply to test that if I pass in 10 articles then 10 components get rendered. Any help would be awesome.\nHi David, the and functions are meant to be used with the output of , not shallow rendering. React doesn't currently provide a helper that will traverse trees for you. Your options for now are to describe the structure of the tree explicitly as in lines 4-5 of your example, or write your own helper module to find descendants you care about. hasn't been implemented yet. Refer to the for what's actually in React.\nCool, thanks for the reply I've returned to just using since the components I'm testing (and their children) don't have state/stores so don't really need mocking out anyway. One last (maybe stupid) question, what does mean?\nSo, I am trying to use Shallow Rendering and have it mostly only thing left I can\u2019t figure out is the recommended way to mock events and how to get with events to pass. I've attempted to use the method directly from the in the test (). This seems dirty\u2026is there a way to just say or something? I could post this on Stack Overflow, but I have had very little luck finding good information about Shallow Rendering online. If anyone has experience with shallow rendering and can give me some help you will be my hero... Source code: ! !\nIf I have an issue with shallow rendering, should I create a new issue, or post it here?\nNew issue please.\nyou might find that helps in providing higher-level assertions for the sort of thing you're doing there. In that particular case, I would avoid asserting on the event handler of the anchor in that test - but a different test would want to call to test the handler.\nSuper late reply, but \"scry\" is a fancy word for \"find\". I'm not sure why we don't just use \"find\".", "commid": "react_issue_2393", "tokennum": 500}], "negative_passages": []} | |
| {"query_id": "q-en-react-4e8e1565bb1cace3befc7dcda3adf7df21abaaeada18815a999f4f6f20de67b9", "query": "}); <ins> var ShallowMixin = assign({}, ReactCompositeComponentMixin, { /** * Initializes the component, renders markup, and registers event listeners. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @param {number} mountDepth number of components in the owner hierarchy * @return {ReactElement} Shallow rendering of the component. * @final * @internal */ mountComponent: function(rootID, transaction, mountDepth) { ReactComponent.Mixin.mountComponent.call( this, rootID, transaction, mountDepth ); var inst = this._instance; // Store a reference from the instance back to the internal representation ReactInstanceMap.set(inst, this); this._compositeLifeCycleState = CompositeLifeCycle.MOUNTING; // No context for shallow-mounted components. inst.props = this._processProps(this._currentElement.props); var initialState = inst.getInitialState ? inst.getInitialState() : null; if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof initialState === 'undefined' && inst.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } invariant( typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', inst.constructor.displayName || 'ReactCompositeComponent' ); inst.state = initialState; this._pendingState = null; this._pendingForceUpdate = false; if (inst.componentWillMount) { inst.componentWillMount(); // When mounting, calls to `setState` by `componentWillMount` will set // `this._pendingState` without triggering a re-render. if (this._pendingState) { inst.state = this._pendingState; this._pendingState = null; } } // No recursive call to instantiateReactComponent for shallow rendering. this._renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); // Done with mounting, `setState` will now trigger UI changes. this._compositeLifeCycleState = null; // No call to this._renderedComponent.mountComponent for shallow // rendering. if (inst.componentDidMount) { transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); } return this._renderedComponent; }, /** * Call the component's `render` method and update the DOM accordingly. * * @param {ReactReconcileTransaction} transaction * @internal */ _updateRenderedComponent: function(transaction) { var prevComponentInstance = this._renderedComponent; var prevRenderedElement = prevComponentInstance._currentElement; // Use the without-owner-or-context variant of _rVC below: var nextRenderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { prevComponentInstance.receiveComponent( nextRenderedElement, transaction ); } else { // These two IDs are actually the same! But nothing should rely on that. var thisID = this._rootNodeID; var prevComponentID = prevComponentInstance._rootNodeID; // Don't unmount previous instance since it was never mounted, due to // shallow render. //prevComponentInstance.unmountComponent(); this._renderedComponent = nextRenderedElement; // ^ no instantiateReactComponent // // no recursive mountComponent return nextRenderedElement; } } }); </ins> var ReactCompositeComponent = { LifeCycle: CompositeLifeCycle, <del> Mixin: ReactCompositeComponentMixin </del> <ins> Mixin: ReactCompositeComponentMixin, ShallowMixin: ShallowMixin </ins> };", "positive_passages": [{"docid": "doc-en-react-74686185b37a0ea269ae4ac6ffd7ebf8062f5d897e5d70eb2610fd72d3a71db1", "text": "Maybe to avoid confusion between the plural and singular forms, whose names would otherwise differ only by one \"s\".\nscry is because of legacy internal FB APIs. No reason.\nLike I'm keenly on the lookout for a way to correctly unit test event handling in React code. Is there any documentation that anyone could point me to? I've looked at but it didn't seem to have something that scratches my particular itch. Here's my scenario (cut down): Where Problem looks like this: I'd like to be able to assert that is wired up for my component but I'm at a loss as to how to do that....\nWhat you actually want is to assert that clicking interacts with the router. Pass in a fake context with a router mock (try Simon) then call Apologies for the brevity, on a phone.\nHi Thanks for responding. I'm not too clear on how to mock successfully when it comes to context. Digging through the source of I came up with this: However this dies a death with: Which makes me think I'm getting the context mocking wrong. Do you know how you successfully mock context with ? I'm using Jasmine (as you probably guessed!) I have a feeling I'm close...\nAre you using React 0.13? You're probably hitting the difference between parent & owner context. Skin deep has a wrapper that helps with this - there's a context example the test suite, but the short answer is to wrap your render in another function call and let skin deep set up the context. This problem should go away in 0.14\nI am using React 0.13, yes. If I port to 0.14 this issue should resolve? I might give that a crack if that's the case (it is in RC after all)\nProblems with the upgrade. I have raised . Will have to return to this later I think.\nI have written and as companion tools when testing with shallow rendering. It gives you the ability to diff on JSX strings rendered instead of React element objects.\nHi, I was wondering what was the state of: simulating events when using shallow rendering using refs when using shallow rendering How can we help make this happen if that's still planned?\nThis issue is pretty stale so I\u2019ll close it.", "commid": "react_issue_2393", "tokennum": 488}], "negative_passages": []} | |
| {"query_id": "q-en-react-4e8e1565bb1cace3befc7dcda3adf7df21abaaeada18815a999f4f6f20de67b9", "query": "}); <ins> var ShallowMixin = assign({}, ReactCompositeComponentMixin, { /** * Initializes the component, renders markup, and registers event listeners. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @param {number} mountDepth number of components in the owner hierarchy * @return {ReactElement} Shallow rendering of the component. * @final * @internal */ mountComponent: function(rootID, transaction, mountDepth) { ReactComponent.Mixin.mountComponent.call( this, rootID, transaction, mountDepth ); var inst = this._instance; // Store a reference from the instance back to the internal representation ReactInstanceMap.set(inst, this); this._compositeLifeCycleState = CompositeLifeCycle.MOUNTING; // No context for shallow-mounted components. inst.props = this._processProps(this._currentElement.props); var initialState = inst.getInitialState ? inst.getInitialState() : null; if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof initialState === 'undefined' && inst.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } invariant( typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', inst.constructor.displayName || 'ReactCompositeComponent' ); inst.state = initialState; this._pendingState = null; this._pendingForceUpdate = false; if (inst.componentWillMount) { inst.componentWillMount(); // When mounting, calls to `setState` by `componentWillMount` will set // `this._pendingState` without triggering a re-render. if (this._pendingState) { inst.state = this._pendingState; this._pendingState = null; } } // No recursive call to instantiateReactComponent for shallow rendering. this._renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); // Done with mounting, `setState` will now trigger UI changes. this._compositeLifeCycleState = null; // No call to this._renderedComponent.mountComponent for shallow // rendering. if (inst.componentDidMount) { transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); } return this._renderedComponent; }, /** * Call the component's `render` method and update the DOM accordingly. * * @param {ReactReconcileTransaction} transaction * @internal */ _updateRenderedComponent: function(transaction) { var prevComponentInstance = this._renderedComponent; var prevRenderedElement = prevComponentInstance._currentElement; // Use the without-owner-or-context variant of _rVC below: var nextRenderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { prevComponentInstance.receiveComponent( nextRenderedElement, transaction ); } else { // These two IDs are actually the same! But nothing should rely on that. var thisID = this._rootNodeID; var prevComponentID = prevComponentInstance._rootNodeID; // Don't unmount previous instance since it was never mounted, due to // shallow render. //prevComponentInstance.unmountComponent(); this._renderedComponent = nextRenderedElement; // ^ no instantiateReactComponent // // no recursive mountComponent return nextRenderedElement; } } }); </ins> var ReactCompositeComponent = { LifeCycle: CompositeLifeCycle, <del> Mixin: ReactCompositeComponentMixin </del> <ins> Mixin: ReactCompositeComponentMixin, ShallowMixin: ShallowMixin </ins> };", "positive_passages": [{"docid": "doc-en-react-648b97e94c725256b26e1bd96a5fd371b8015ffce2e3e1a0a44a2263c4489568", "text": "If there are specific features you miss in the shallow renderer please create new issues with proposals on how they should work. Note that we a new that is much more feature-complete.", "commid": "react_issue_2393", "tokennum": 37}], "negative_passages": []} | |
| {"query_id": "q-en-react-4f5ca05be9bf12de509df49a1bc2369786e7cc707fb07112cdeb0b10991cc53d", "query": "// For quickly matching children type, to test if can be treated as content. var CONTENT_TYPES = {'string': true, 'number': true}; <del> var DANGEROUSLY_SET_INNER_HTML = keyOf({dangerouslySetInnerHTML: null}); </del> var STYLE = keyOf({style: null}); /**", "positive_passages": [{"docid": "doc-en-react-9306121422e93f6146586d22ff20af2d3e2d2860ed922937e70054809fe064b5", "text": "reported the following issue on IRC: (Both on master and 4.0) The repro case is: 1) Render 2) Render 3) Render the same as 1) The div has its innerHTML empty instead of . I don't really know what's going on. can you guys look at it?\nOne other tidbit: this only seems to happen when the value is exactly the same in step 3 as it was in step 1. If it's different (i.e. ), things work as expected.\nWhat happens if you change step 2 to a instead of a ? It works, right?\nI just reduced the test case to 19 lines.\nyeah changing 2) to use a span works as expected\nIf anyone wants to look into this, the bug is probably here\nI cannot reproduce what you are seeing: It also bugs if I use a different string\nI'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying.\nI know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a property to the React component containing the property. So, does not seem to work reproducibly, whereas seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a statement if that component gets rerendered multiple times with different inner content. Just posting this here in case other people have the same issue and stumble upon this.\nthx you saved my day :-)\nSeems like the issue is back again. Thanks, solves the problem for me too.\nIf any of you can post a simple repro case showing the broken behavior here, I'd be happy to take a look at fixing it.\nTook me a while to repro, but here you go: (ugly, but demonstrates the issue well)\nThanks. This is the same issue as . No fix currently, but using the key as a workaround is fine and I'll see if we can fix this sometime.\nThanks that was giving me fits!\nIf anyone is still seeing issues on 0.14, please make a new issue with a simple repro case.", "commid": "react_issue_377", "tokennum": 469}], "negative_passages": []} | |
| {"query_id": "q-en-react-4f5ca05be9bf12de509df49a1bc2369786e7cc707fb07112cdeb0b10991cc53d", "query": "// For quickly matching children type, to test if can be treated as content. var CONTENT_TYPES = {'string': true, 'number': true}; <del> var DANGEROUSLY_SET_INNER_HTML = keyOf({dangerouslySetInnerHTML: null}); </del> var STYLE = keyOf({style: null}); /**", "positive_passages": [{"docid": "doc-en-react-2561d4a0be5f333acf881b6f80c1a973b0d2a5e9e6140ce5d6d62900271a0991", "text": "I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:\nReading out will rarely give you what you put in because the browser does various kinds of normalization on it. If you can repro with a standalone example though I'm happy to take a look.\nwell, that's more like a control shot :-)\nLooks like the issue still exist in 16.4.1 when using on a tag, you cannot nest other or . issue is fixed by replacing the container with a\nIf you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example. when using dangerouslySetInnerHTML on a tag, you cannot nest other or This sounds like browsers work. You can't nest into . This is why React warns when you do it (except in which case React can't validate it).", "commid": "react_issue_377", "tokennum": 312}], "negative_passages": []} | |
| {"query_id": "q-en-react-515b29ee11881e92c3d735806e30784cc4819c5a1da8fd7ef2479c78b9da5066", "query": "// Intentionally do not call componentDidUpdate() // because DOM refs are not available. } <del> _updateStateFromStaticLifecycle(props: Object) { if (this._element === null) { return; } const {type} = this._element; if (typeof type.getDerivedStateFromProps === 'function') { const oldState = this._newState || this._instance.state; const partialState = type.getDerivedStateFromProps.call( null, props, oldState, ); if (partialState != null) { const newState = Object.assign({}, oldState, partialState); this._instance.state = this._newState = newState; } } } </del> } let currentlyValidatingElement = null;", "positive_passages": [{"docid": "doc-en-react-af6422597abfc3705e1e016cf37e5dbfbfdcf0923b24267ad3eb49d20f8d6064", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug What is the current behavior? In , the shallow renderer will set instance state in so the and will be the same in , which is different with the behavior of real rendering. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: given below class component: render with ReactDOM, the will return true since will be the old value : In shallow renderer, the behavior is different: What is the expected behavior? ShallowRenderer should not set the instance state in getDeriveStateFromProps, or in the we have no way to compare it. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? I have tested this in master branch and 16.3, both not work. By the way this problem is related to airbnb/enzyme . If it's recoginzed as a bug I can provide a PR in next several days.", "commid": "react_issue_14607", "tokennum": 285}], "negative_passages": []} | |
| {"query_id": "q-en-react-51678c3bd3e4680baa79d1e5057e4666e6015472ebe50ed392a549853ba8b6c0", "query": "String type ``` <ins> > Note: > > As of v0.12, returning `false` from an event handler will no longer stop event propagation. Instead, `e.stopPropagation()` or `e.preventDefault()` should be triggered manually, as appropriate. </ins> ## Supported Events", "positive_passages": [{"docid": "doc-en-react-64f27efe9c05b5e90637eacbe11d9aa29892489350fa2c0c136e339a2cc54a88", "text": "We currently support this, but it makes code less understandable and we'd like to stop supporting it and encourage people to use either e.preventDefault() or e.stopPropagation() as appropriate.\n:+1: And then free up the event handler's return value for something else.\nyou mean? :)\nMaybe =) Otherwise we can always use it to indicate something in a potential future event system.", "commid": "react_issue_2015", "tokennum": 90}], "negative_passages": []} | |
| {"query_id": "q-en-react-52fa3afcc6b9090f8a5009045eaa05e3559e3078515a178b8d27f0e2f46b3951", "query": "expect(console.warn.calls.length).toBe(0); }); <ins> it('should support injected wrapper components as DOM components', function() { var injectedDOMComponents = [ 'button', 'form', 'iframe', 'img', 'input', 'option', 'select', 'textarea', 'html', 'head', 'body' ]; injectedDOMComponents.forEach(function(type) { var component = ReactTestUtils.renderIntoDocument( React.createElement(type) ); expect(component.tagName).toBe(type.toUpperCase()); expect(ReactTestUtils.isDOMComponent(component)).toBe(true); }); }); </ins> });", "positive_passages": [{"docid": "doc-en-react-083e8ad88e164af524f1d788f1c1f74caee8c62754c5c2a218713aa219c30266", "text": "I\u2019ve tried to update from react 0.12.2 to 0.13.0 which caused several unit tests of my project to fail. I use react to render html on the server side, this includes the basic html structure like , and elements. All unit tests dealing with such elements are failing with react 0.13.0 but they worked fine with 0.12.2. Here is a minimal example : Running this with react 0.12.2, correctly logs the text content of the title:Running this with react 0.13.0 throws a TypeError\nI think this is just a bug, not an intentional breaking change. Thanks for reporting.", "commid": "react_issue_3421", "tokennum": 136}], "negative_passages": []} | |
| {"query_id": "q-en-react-53564b213c623cfba3fa212dc2b93306b06ff45c6a7d28a5431b72906fd48898", "query": "<a class=\"docs-next\" href=\"/react/tips/{{ page.next }}\">Next →</a> {% endif %} </div> <del> <div class=\"fb-comments\" data-width=\"650\" data-num-posts=\"10\" data-href=\"{{ site.url }}{{ site.baseurl }}{{ page.url }}\"></div> </del> </div> </section>", "positive_passages": [{"docid": "doc-en-react-ca64118bf847d4660407dc0cfa80dc13393c771af4b88e26ffe9546e10663249", "text": "Should those comment sections exist? I'd rather people come to IRC. Their questions are often neglected at the bottom of a doc page.\n:+1: for shutting down comments\n+1\n:+1:", "commid": "react_issue_915", "tokennum": 43}], "negative_passages": []} | |
| {"query_id": "q-en-react-535c7a8b67305f35d128ac7496de2f759df79e190856d21b010c23c4af7a63fa", "query": "*/ executeDispatch: function(event, listener, domID) { var returnValue = EventPluginUtils.executeDispatch(event, listener, domID); <ins> warning( typeof returnValue !== 'boolean', 'Returning `false` from an event handler is deprecated and will be ' + 'ignored in a future release. Instead, manually call ' + 'e.stopPropagation() or e.preventDefault(), as appropriate.' ); </ins> if (returnValue === false) { event.stopPropagation(); event.preventDefault();", "positive_passages": [{"docid": "doc-en-react-64f27efe9c05b5e90637eacbe11d9aa29892489350fa2c0c136e339a2cc54a88", "text": "We currently support this, but it makes code less understandable and we'd like to stop supporting it and encourage people to use either e.preventDefault() or e.stopPropagation() as appropriate.\n:+1: And then free up the event handler's return value for something else.\nyou mean? :)\nMaybe =) Otherwise we can always use it to indicate something in a potential future event system.", "commid": "react_issue_2015", "tokennum": 90}], "negative_passages": []} | |
| {"query_id": "q-en-react-55ed93c95b89cfb4d7a03d9b171653c7d0376a4f11cc87f288da97bed5918c13", "query": "ON_CLICK_KEY, recordID.bind(null, getID(GRANDPARENT)) ); <ins> spyOn(console, 'warn'); </ins> ReactTestUtils.Simulate.click(CHILD); expect(idCallOrder.length).toBe(1); expect(idCallOrder[0]).toBe(getID(CHILD)); <ins> expect(console.warn.calls.length).toEqual(1); expect(console.warn.calls[0].args[0]).toBe( 'Warning: Returning `false` from an event handler is deprecated and ' + 'will be ignored in a future release. Instead, manually call ' + 'e.stopPropagation() or e.preventDefault(), as appropriate.' ); </ins> }); /**", "positive_passages": [{"docid": "doc-en-react-64f27efe9c05b5e90637eacbe11d9aa29892489350fa2c0c136e339a2cc54a88", "text": "We currently support this, but it makes code less understandable and we'd like to stop supporting it and encourage people to use either e.preventDefault() or e.stopPropagation() as appropriate.\n:+1: And then free up the event handler's return value for something else.\nyou mean? :)\nMaybe =) Otherwise we can always use it to indicate something in a potential future event system.", "commid": "react_issue_2015", "tokennum": 90}], "negative_passages": []} | |
| {"query_id": "q-en-react-5929f62864a44b69496913c49c6e395211bd5259cb40403cd7beea18d2f32348", "query": "var MorphingComponent; var ChildUpdates; var React; <ins> var ReactComponent; </ins> var ReactCurrentOwner; var ReactPropTypes; var ReactTestUtils;", "positive_passages": [{"docid": "doc-en-react-303f5589a27626c8ed5d6f0f930b2b84163d1cdd0133511f0a90007b7a44f4fd", "text": "When unmounting components like this: a memory leak happens because ReactMount.getID(node) puts DOM nodes back to nodeCache if they are not there.. just right after they were purged from cache. Here is what's happing when unmounting that example component: label component gets purged from nodeCache when ReactDOMInput component is going to unmount it calls this method: which contains this.getDOMNode() which iterates through the children of the Form element calling getID() on each of them.. which puts these elements back into the cache. So first they were purged and here they are all put back in cache causing a memory leak :( I'm playing with React just 3rd day so not sure of a way to correctly fix this issue\n(I took the liberty to edit your comment to add syntax highlighting)\nI can't reproduce this. With this diff applied, I loaded http://127.0.0.1:8000/examples/ballmer-peak/ in the console and checked -- it was empty. Am I misunderstanding?\nYes. You've missed one more user defined component in there.. Here you go:\nThanks, fixed in .\nThank you for fast fix :)\nThanks for the find/fix!", "commid": "react_issue_781", "tokennum": 272}], "negative_passages": []} | |
| {"query_id": "q-en-react-644498b25172923430968e6f65e86cb9c4cc558d4a26844ecbd495a5405bc6db", "query": "setRefreshHandler: __DEV__ ? setRefreshHandler : null, // Enables DevTools to append owner stacks to error messages in DEV mode. getCurrentFiber: __DEV__ ? getCurrentFiberForDevTools : null, <ins> // Enables DevTools to detect reconciler version rather than renderer version // which may not match for third party renderers. reconcilerVersion: ReactVersion, </ins> }); }", "positive_passages": [{"docid": "doc-en-react-8544d3f8d9a29fb32eabf9f48363d5d52db07eccaeed98a815ae9f22c135bf31", "text": "This is a followup issue for pmndrs/react-three-fiber From my understanding of , the DevTools parse the version number advertised by the renderer in to select how to parse the internal fiber object. Unfortunately this means that third-party renderers that advertise a version lower than the equivalent React version for the release they are using get misclassified: for instance is using which is equivalent to , and since major version is much lower than it uses the default values for the enum which in turns lead to getting identified as and hook inspection being unavailable. A short term solution for renderers is to advertise a React-compatible version number, but ideally this is an implementation detail of the devtools that users of should not have to be aware of (also this means the version number displayed in the devtools is wrong). I'm not sure I'm familiar enough with the internals of the devtools to open a PR for this, but since the version parsing logic is used to detect features that are internal to anyway I guess a solution would be to have the Reconciler package add its own value for the constant along with the parameters sent to the devtools backend, and have the devtools use this string if its available over the renderer version.\nOnce and land (and get released) newer versions of the reconciler will inject its own version (to be used instead of the renderer version). Unfortunately this won't help you until you upgrade.", "commid": "react_issue_21262", "tokennum": 313}], "negative_passages": []} | |
| {"query_id": "q-en-react-668254523681a0d5e096d62901f5499efd318121a7c9a2bdb17c4ba2f67bb4be", "query": "frame.debugElementStack = []; } this.stack.push(frame); <ins> this.previousWasTextNode = false; </ins> return out; } }", "positive_passages": [{"docid": "doc-en-react-ec5ecfe108c5622ae0f0ce83ae6ca196a4c0778b1ab6d72b9b10da2f746acbc9", "text": "Observed this on react This renders as . If you try to hydrate this you'll get the error: Text content did not match. Server: \"bc\" Client: \"b\".\nI suppose the bug here is that we do not separate from here but we should.\nReact has been released. Please update , , and (if you use it) to this version and let us know if it solved the issue! We\u2019d appreciate if you could test before Monday when we plan to get out.\nEverything looks good on my end, thanks!", "commid": "react_issue_10598", "tokennum": 112}], "negative_passages": []} | |
| {"query_id": "q-en-react-6b69fb32ce93465fc57a456256dc3cc3d407ee4a4b661ed31fd88be37464c66d", "query": "/** * @private */ <ins> _renderValidatedComponentWithoutOwnerOrContext: function() { var inst = this._instance; var renderedComponent = inst.render(); if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. renderedComponent = null; } } return renderedComponent; }, /** * @private */ </ins> _renderValidatedComponent: ReactPerf.measure( 'ReactCompositeComponent', '_renderValidatedComponent',", "positive_passages": [{"docid": "doc-en-react-43bd8c935fcf00bee8061fadc9d53ee4ce08d7674cd1b756a95fad46456d6e25", "text": "We need a way to test the output of a single level React component without resolving it all the way down to the bottom layer (whatever that is). I'm thinking something like this: Basically, this fix needs to go through the entire life-cycle of ReactCompositeComponent. It just needs to bail out whenever it would've continued rendering.\nReopened so that we can track the remaining features (refs etc.)\nWeird, I thought GitHub only closed issues if you used language like \"fixes #NNNN\", not if you simply mentioned the issue at all. Sorry about that.\nThe PR text included \"WIP to \"\nIs the rest (refs support) blocked by or can more work be done now?\nAny reason this doesn't support other than that it's not implemented yet? I was hoping to do something like\nthat's supposed to work. Can you post a minimal repro?\nHow do you do this? does not return an instance.\nIt works if I use so I think could just return that from . (I also have to shim because React expects it to be defined for some reason.)\nFinding this quite useful. But it has been a bit inconvenient to have among the children when an element is conditionally rendered.\nThe idea was to make the helpers ignore null which could help with that. Perhaps we could have return an iterable which traverses nested arrays and ignores null.\nReally? Allowing nulls was a change intentionally introduced a long time ago. In I have an implementation of toArray.\nAllowing empty children (null, undefined, boolean) was a controversial topic, where we eventually landed on null/boolean/undefined being passed through. That way you could explicitly treat an empty slot as something special. This landed very early on before we really started seeing pattern developing. However, IMO, we've seen that this leads to inconsistent implementations where null slots will break and is not possible to use. It is unclear whether a set of children allows nullable slots, and if they do, it is unclear what that means. For example, in a grid layout component, does an empty slot mean that there should be an empty column in the grid, or that it should be skipped? Therefore, a lot of our components end up with explicit null checks. Meaning boilerplate, and inconsistent behavior when they're forgotten.", "commid": "react_issue_2393", "tokennum": 498}], "negative_passages": []} | |
| {"query_id": "q-en-react-6b69fb32ce93465fc57a456256dc3cc3d407ee4a4b661ed31fd88be37464c66d", "query": "/** * @private */ <ins> _renderValidatedComponentWithoutOwnerOrContext: function() { var inst = this._instance; var renderedComponent = inst.render(); if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. renderedComponent = null; } } return renderedComponent; }, /** * @private */ </ins> _renderValidatedComponent: ReactPerf.measure( 'ReactCompositeComponent', '_renderValidatedComponent',", "positive_passages": [{"docid": "doc-en-react-26f74882fe59ad2106ea606628fef442808db170983d47929460fee2f487ed92", "text": "Therefore, I think the default should be to filter out nulls which is consistent with the behavior of the built-ins components. It is still possible to get access to the raw data if you have a different type of children in mind where empty slots is meaningful.\nHow should this work with the TestUtils functions. For example, this fails: I can't see any other info on mentioned at the start of this issue, is this what I'm missing? My end goal is simply to test that if I pass in 10 articles then 10 components get rendered. Any help would be awesome.\nHi David, the and functions are meant to be used with the output of , not shallow rendering. React doesn't currently provide a helper that will traverse trees for you. Your options for now are to describe the structure of the tree explicitly as in lines 4-5 of your example, or write your own helper module to find descendants you care about. hasn't been implemented yet. Refer to the for what's actually in React.\nCool, thanks for the reply I've returned to just using since the components I'm testing (and their children) don't have state/stores so don't really need mocking out anyway. One last (maybe stupid) question, what does mean?\nSo, I am trying to use Shallow Rendering and have it mostly only thing left I can\u2019t figure out is the recommended way to mock events and how to get with events to pass. I've attempted to use the method directly from the in the test (). This seems dirty\u2026is there a way to just say or something? I could post this on Stack Overflow, but I have had very little luck finding good information about Shallow Rendering online. If anyone has experience with shallow rendering and can give me some help you will be my hero... Source code: ! !\nIf I have an issue with shallow rendering, should I create a new issue, or post it here?\nNew issue please.\nyou might find that helps in providing higher-level assertions for the sort of thing you're doing there. In that particular case, I would avoid asserting on the event handler of the anchor in that test - but a different test would want to call to test the handler.\nSuper late reply, but \"scry\" is a fancy word for \"find\". I'm not sure why we don't just use \"find\".", "commid": "react_issue_2393", "tokennum": 500}], "negative_passages": []} | |
| {"query_id": "q-en-react-6b69fb32ce93465fc57a456256dc3cc3d407ee4a4b661ed31fd88be37464c66d", "query": "/** * @private */ <ins> _renderValidatedComponentWithoutOwnerOrContext: function() { var inst = this._instance; var renderedComponent = inst.render(); if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. renderedComponent = null; } } return renderedComponent; }, /** * @private */ </ins> _renderValidatedComponent: ReactPerf.measure( 'ReactCompositeComponent', '_renderValidatedComponent',", "positive_passages": [{"docid": "doc-en-react-74686185b37a0ea269ae4ac6ffd7ebf8062f5d897e5d70eb2610fd72d3a71db1", "text": "Maybe to avoid confusion between the plural and singular forms, whose names would otherwise differ only by one \"s\".\nscry is because of legacy internal FB APIs. No reason.\nLike I'm keenly on the lookout for a way to correctly unit test event handling in React code. Is there any documentation that anyone could point me to? I've looked at but it didn't seem to have something that scratches my particular itch. Here's my scenario (cut down): Where Problem looks like this: I'd like to be able to assert that is wired up for my component but I'm at a loss as to how to do that....\nWhat you actually want is to assert that clicking interacts with the router. Pass in a fake context with a router mock (try Simon) then call Apologies for the brevity, on a phone.\nHi Thanks for responding. I'm not too clear on how to mock successfully when it comes to context. Digging through the source of I came up with this: However this dies a death with: Which makes me think I'm getting the context mocking wrong. Do you know how you successfully mock context with ? I'm using Jasmine (as you probably guessed!) I have a feeling I'm close...\nAre you using React 0.13? You're probably hitting the difference between parent & owner context. Skin deep has a wrapper that helps with this - there's a context example the test suite, but the short answer is to wrap your render in another function call and let skin deep set up the context. This problem should go away in 0.14\nI am using React 0.13, yes. If I port to 0.14 this issue should resolve? I might give that a crack if that's the case (it is in RC after all)\nProblems with the upgrade. I have raised . Will have to return to this later I think.\nI have written and as companion tools when testing with shallow rendering. It gives you the ability to diff on JSX strings rendered instead of React element objects.\nHi, I was wondering what was the state of: simulating events when using shallow rendering using refs when using shallow rendering How can we help make this happen if that's still planned?\nThis issue is pretty stale so I\u2019ll close it.", "commid": "react_issue_2393", "tokennum": 488}], "negative_passages": []} | |
| {"query_id": "q-en-react-6b69fb32ce93465fc57a456256dc3cc3d407ee4a4b661ed31fd88be37464c66d", "query": "/** * @private */ <ins> _renderValidatedComponentWithoutOwnerOrContext: function() { var inst = this._instance; var renderedComponent = inst.render(); if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. renderedComponent = null; } } return renderedComponent; }, /** * @private */ </ins> _renderValidatedComponent: ReactPerf.measure( 'ReactCompositeComponent', '_renderValidatedComponent',", "positive_passages": [{"docid": "doc-en-react-648b97e94c725256b26e1bd96a5fd371b8015ffce2e3e1a0a44a2263c4489568", "text": "If there are specific features you miss in the shallow renderer please create new issues with proposals on how they should work. Note that we a new that is much more feature-complete.", "commid": "react_issue_2393", "tokennum": 37}], "negative_passages": []} | |
| {"query_id": "q-en-react-6c4605bcff962e7970532bc4975441c8a35d51e870d5218ea656af6a717e96a1", "query": "httpEquiv: null, icon: null, id: MUST_USE_PROPERTY, <ins> keyParams: MUST_USE_ATTRIBUTE, keyType: MUST_USE_ATTRIBUTE, </ins> label: null, lang: null, list: MUST_USE_ATTRIBUTE,", "positive_passages": [{"docid": "doc-en-react-c106a437ddd3bd1957c6502f10dcab059cffc9005b0db8685ba1254d6e535341", "text": "I'm using tag to generate client certificates and I'm missing challenge and keytype attributes.\nIt would be cool if React gives us the opportunity to use different syntax for attrs and props: And may be: There would be no need to know what tags React supporting.\nThere's more planned to alleviate the issues around unknown elements and properties, but we're not there yet. We have no plans on to use different syntax. Adding the additional attributes here seems totally reasonable.\nWill try to take a stab at this. I assume this is as simple as adding those props to , and then adding tests. Is that correct or am I missing anything significant?\nIt's even easier than that since we don't really have tests for the attributes. But do actually test in a couple browsers that changing values across renders is reflected appropriately (usually the issues is property vs attribute).\nYou're quick, guys. Thanks in advance!\nBy 'across renders' you mean simply triggering a re-render (by changing the value)?\nYea. I usually just make a simple component with a button that toggles state so I can test with multiple values easily.\nGreat. Thx.\nI missed a detail in docs. Although, I don't need it, there's an additional attribute, keyparams, which is required with \"dsa\" and \"ec\" keytypes. See\nHave this working, though I'm not entirely clear if these should be , or . I wasn't able to deduce the meaning of these from the code. Is there someplace I can read up on these?\nThose are used to determine if we do or if we do when updating. means it doesn't matter and browsers should work with either. Currently we use properties in that case but we may switch that in the future. indicate that they must be set & removed as a property or an attribute.\nThanks. That makes sense. Had to use to get it to work properly across Chrome/FF/Safari. Your testing method great as well. Thx for your help", "commid": "react_issue_3961", "tokennum": 430}], "negative_passages": []} | |
| {"query_id": "q-en-react-71d2e7ed0b936ec201330e7ff521ce815d042f1380509589f4044829f11909db", "query": "findHostInstancesForRefresh, } from './ReactFiberHotReloading.old'; import {markRenderScheduled} from './SchedulingProfiler'; <ins> import ReactVersion from 'shared/ReactVersion'; </ins> export {registerMutableSourceForHydration} from './ReactMutableSource.old'; export {createPortal} from './ReactPortal'; export {", "positive_passages": [{"docid": "doc-en-react-8544d3f8d9a29fb32eabf9f48363d5d52db07eccaeed98a815ae9f22c135bf31", "text": "This is a followup issue for pmndrs/react-three-fiber From my understanding of , the DevTools parse the version number advertised by the renderer in to select how to parse the internal fiber object. Unfortunately this means that third-party renderers that advertise a version lower than the equivalent React version for the release they are using get misclassified: for instance is using which is equivalent to , and since major version is much lower than it uses the default values for the enum which in turns lead to getting identified as and hook inspection being unavailable. A short term solution for renderers is to advertise a React-compatible version number, but ideally this is an implementation detail of the devtools that users of should not have to be aware of (also this means the version number displayed in the devtools is wrong). I'm not sure I'm familiar enough with the internals of the devtools to open a PR for this, but since the version parsing logic is used to detect features that are internal to anyway I guess a solution would be to have the Reconciler package add its own value for the constant along with the parameters sent to the devtools backend, and have the devtools use this string if its available over the renderer version.\nOnce and land (and get released) newer versions of the reconciler will inject its own version (to be used instead of the renderer version). Unfortunately this won't help you until you upgrade.", "commid": "react_issue_21262", "tokennum": 313}], "negative_passages": []} | |
| {"query_id": "q-en-react-77ec2c472351a9f19be4c0cb51ed0b077ff578f9af5252e6f1817a932c0a3fa8", "query": "}; }, <ins> createRenderer: function() { return new ReactShallowRenderer(); }, </ins> Simulate: null, SimulateNative: {} }; /** <ins> * @class ReactShallowRenderer */ var ReactShallowRenderer = function() { this._instance = null; }; ReactShallowRenderer.prototype.getRenderOutput = function() { return (this._instance && this._instance._renderedComponent) || null; }; var ShallowComponentWrapper = function(inst) { this._instance = inst; } assign( ShallowComponentWrapper.prototype, ReactCompositeComponent.ShallowMixin ); ReactShallowRenderer.prototype.render = function(element) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); this._render(element, transaction); ReactUpdates.ReactReconcileTransaction.release(transaction); }; ReactShallowRenderer.prototype._render = function(element, transaction) { if (!this._instance) { var rootID = ReactInstanceHandles.createReactRootID(); var instance = new ShallowComponentWrapper(new element.type(element.props)); instance.construct(element); instance.mountComponent(rootID, transaction, 0); this._instance = instance; } else { this._instance.receiveComponent(element, transaction); } }; /** </ins> * Exports: * * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`", "positive_passages": [{"docid": "doc-en-react-43bd8c935fcf00bee8061fadc9d53ee4ce08d7674cd1b756a95fad46456d6e25", "text": "We need a way to test the output of a single level React component without resolving it all the way down to the bottom layer (whatever that is). I'm thinking something like this: Basically, this fix needs to go through the entire life-cycle of ReactCompositeComponent. It just needs to bail out whenever it would've continued rendering.\nReopened so that we can track the remaining features (refs etc.)\nWeird, I thought GitHub only closed issues if you used language like \"fixes #NNNN\", not if you simply mentioned the issue at all. Sorry about that.\nThe PR text included \"WIP to \"\nIs the rest (refs support) blocked by or can more work be done now?\nAny reason this doesn't support other than that it's not implemented yet? I was hoping to do something like\nthat's supposed to work. Can you post a minimal repro?\nHow do you do this? does not return an instance.\nIt works if I use so I think could just return that from . (I also have to shim because React expects it to be defined for some reason.)\nFinding this quite useful. But it has been a bit inconvenient to have among the children when an element is conditionally rendered.\nThe idea was to make the helpers ignore null which could help with that. Perhaps we could have return an iterable which traverses nested arrays and ignores null.\nReally? Allowing nulls was a change intentionally introduced a long time ago. In I have an implementation of toArray.\nAllowing empty children (null, undefined, boolean) was a controversial topic, where we eventually landed on null/boolean/undefined being passed through. That way you could explicitly treat an empty slot as something special. This landed very early on before we really started seeing pattern developing. However, IMO, we've seen that this leads to inconsistent implementations where null slots will break and is not possible to use. It is unclear whether a set of children allows nullable slots, and if they do, it is unclear what that means. For example, in a grid layout component, does an empty slot mean that there should be an empty column in the grid, or that it should be skipped? Therefore, a lot of our components end up with explicit null checks. Meaning boilerplate, and inconsistent behavior when they're forgotten.", "commid": "react_issue_2393", "tokennum": 498}], "negative_passages": []} | |
| {"query_id": "q-en-react-77ec2c472351a9f19be4c0cb51ed0b077ff578f9af5252e6f1817a932c0a3fa8", "query": "}; }, <ins> createRenderer: function() { return new ReactShallowRenderer(); }, </ins> Simulate: null, SimulateNative: {} }; /** <ins> * @class ReactShallowRenderer */ var ReactShallowRenderer = function() { this._instance = null; }; ReactShallowRenderer.prototype.getRenderOutput = function() { return (this._instance && this._instance._renderedComponent) || null; }; var ShallowComponentWrapper = function(inst) { this._instance = inst; } assign( ShallowComponentWrapper.prototype, ReactCompositeComponent.ShallowMixin ); ReactShallowRenderer.prototype.render = function(element) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); this._render(element, transaction); ReactUpdates.ReactReconcileTransaction.release(transaction); }; ReactShallowRenderer.prototype._render = function(element, transaction) { if (!this._instance) { var rootID = ReactInstanceHandles.createReactRootID(); var instance = new ShallowComponentWrapper(new element.type(element.props)); instance.construct(element); instance.mountComponent(rootID, transaction, 0); this._instance = instance; } else { this._instance.receiveComponent(element, transaction); } }; /** </ins> * Exports: * * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`", "positive_passages": [{"docid": "doc-en-react-26f74882fe59ad2106ea606628fef442808db170983d47929460fee2f487ed92", "text": "Therefore, I think the default should be to filter out nulls which is consistent with the behavior of the built-ins components. It is still possible to get access to the raw data if you have a different type of children in mind where empty slots is meaningful.\nHow should this work with the TestUtils functions. For example, this fails: I can't see any other info on mentioned at the start of this issue, is this what I'm missing? My end goal is simply to test that if I pass in 10 articles then 10 components get rendered. Any help would be awesome.\nHi David, the and functions are meant to be used with the output of , not shallow rendering. React doesn't currently provide a helper that will traverse trees for you. Your options for now are to describe the structure of the tree explicitly as in lines 4-5 of your example, or write your own helper module to find descendants you care about. hasn't been implemented yet. Refer to the for what's actually in React.\nCool, thanks for the reply I've returned to just using since the components I'm testing (and their children) don't have state/stores so don't really need mocking out anyway. One last (maybe stupid) question, what does mean?\nSo, I am trying to use Shallow Rendering and have it mostly only thing left I can\u2019t figure out is the recommended way to mock events and how to get with events to pass. I've attempted to use the method directly from the in the test (). This seems dirty\u2026is there a way to just say or something? I could post this on Stack Overflow, but I have had very little luck finding good information about Shallow Rendering online. If anyone has experience with shallow rendering and can give me some help you will be my hero... Source code: ! !\nIf I have an issue with shallow rendering, should I create a new issue, or post it here?\nNew issue please.\nyou might find that helps in providing higher-level assertions for the sort of thing you're doing there. In that particular case, I would avoid asserting on the event handler of the anchor in that test - but a different test would want to call to test the handler.\nSuper late reply, but \"scry\" is a fancy word for \"find\". I'm not sure why we don't just use \"find\".", "commid": "react_issue_2393", "tokennum": 500}], "negative_passages": []} | |
| {"query_id": "q-en-react-77ec2c472351a9f19be4c0cb51ed0b077ff578f9af5252e6f1817a932c0a3fa8", "query": "}; }, <ins> createRenderer: function() { return new ReactShallowRenderer(); }, </ins> Simulate: null, SimulateNative: {} }; /** <ins> * @class ReactShallowRenderer */ var ReactShallowRenderer = function() { this._instance = null; }; ReactShallowRenderer.prototype.getRenderOutput = function() { return (this._instance && this._instance._renderedComponent) || null; }; var ShallowComponentWrapper = function(inst) { this._instance = inst; } assign( ShallowComponentWrapper.prototype, ReactCompositeComponent.ShallowMixin ); ReactShallowRenderer.prototype.render = function(element) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); this._render(element, transaction); ReactUpdates.ReactReconcileTransaction.release(transaction); }; ReactShallowRenderer.prototype._render = function(element, transaction) { if (!this._instance) { var rootID = ReactInstanceHandles.createReactRootID(); var instance = new ShallowComponentWrapper(new element.type(element.props)); instance.construct(element); instance.mountComponent(rootID, transaction, 0); this._instance = instance; } else { this._instance.receiveComponent(element, transaction); } }; /** </ins> * Exports: * * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`", "positive_passages": [{"docid": "doc-en-react-74686185b37a0ea269ae4ac6ffd7ebf8062f5d897e5d70eb2610fd72d3a71db1", "text": "Maybe to avoid confusion between the plural and singular forms, whose names would otherwise differ only by one \"s\".\nscry is because of legacy internal FB APIs. No reason.\nLike I'm keenly on the lookout for a way to correctly unit test event handling in React code. Is there any documentation that anyone could point me to? I've looked at but it didn't seem to have something that scratches my particular itch. Here's my scenario (cut down): Where Problem looks like this: I'd like to be able to assert that is wired up for my component but I'm at a loss as to how to do that....\nWhat you actually want is to assert that clicking interacts with the router. Pass in a fake context with a router mock (try Simon) then call Apologies for the brevity, on a phone.\nHi Thanks for responding. I'm not too clear on how to mock successfully when it comes to context. Digging through the source of I came up with this: However this dies a death with: Which makes me think I'm getting the context mocking wrong. Do you know how you successfully mock context with ? I'm using Jasmine (as you probably guessed!) I have a feeling I'm close...\nAre you using React 0.13? You're probably hitting the difference between parent & owner context. Skin deep has a wrapper that helps with this - there's a context example the test suite, but the short answer is to wrap your render in another function call and let skin deep set up the context. This problem should go away in 0.14\nI am using React 0.13, yes. If I port to 0.14 this issue should resolve? I might give that a crack if that's the case (it is in RC after all)\nProblems with the upgrade. I have raised . Will have to return to this later I think.\nI have written and as companion tools when testing with shallow rendering. It gives you the ability to diff on JSX strings rendered instead of React element objects.\nHi, I was wondering what was the state of: simulating events when using shallow rendering using refs when using shallow rendering How can we help make this happen if that's still planned?\nThis issue is pretty stale so I\u2019ll close it.", "commid": "react_issue_2393", "tokennum": 488}], "negative_passages": []} | |
| {"query_id": "q-en-react-77ec2c472351a9f19be4c0cb51ed0b077ff578f9af5252e6f1817a932c0a3fa8", "query": "}; }, <ins> createRenderer: function() { return new ReactShallowRenderer(); }, </ins> Simulate: null, SimulateNative: {} }; /** <ins> * @class ReactShallowRenderer */ var ReactShallowRenderer = function() { this._instance = null; }; ReactShallowRenderer.prototype.getRenderOutput = function() { return (this._instance && this._instance._renderedComponent) || null; }; var ShallowComponentWrapper = function(inst) { this._instance = inst; } assign( ShallowComponentWrapper.prototype, ReactCompositeComponent.ShallowMixin ); ReactShallowRenderer.prototype.render = function(element) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); this._render(element, transaction); ReactUpdates.ReactReconcileTransaction.release(transaction); }; ReactShallowRenderer.prototype._render = function(element, transaction) { if (!this._instance) { var rootID = ReactInstanceHandles.createReactRootID(); var instance = new ShallowComponentWrapper(new element.type(element.props)); instance.construct(element); instance.mountComponent(rootID, transaction, 0); this._instance = instance; } else { this._instance.receiveComponent(element, transaction); } }; /** </ins> * Exports: * * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`", "positive_passages": [{"docid": "doc-en-react-648b97e94c725256b26e1bd96a5fd371b8015ffce2e3e1a0a44a2263c4489568", "text": "If there are specific features you miss in the shallow renderer please create new issues with proposals on how they should work. Note that we a new that is much more feature-complete.", "commid": "react_issue_2393", "tokennum": 37}], "negative_passages": []} | |
| {"query_id": "q-en-react-78cffa44a5792fa2be826ade74ccdf98e8cc1e3e7b1e8f3af5e56054b949682b", "query": "if (consoleSettingsRef.appendComponentStack) { const lastArg = args.length > 0 ? args[args.length - 1] : null; const alreadyHasComponentStack = <del> lastArg !== null && isStringComponentStack(lastArg); </del> <ins> typeof lastArg === 'string' && isStringComponentStack(lastArg); </ins> // If we are ever called with a string that already has a component stack, // e.g. a React error/warning, don't append a second stack.", "positive_passages": [{"docid": "doc-en-react-32151ac5f4d8d7fcb6b59730e1224ffe5f513940e4fe6d4c7eec610e94d11802", "text": "<!-- Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest version of the relevant React packages to make sure your issue has not already been fixed. --React version: DevTools version 4.12.2- from within a React component where the last argument is typeof <!-- Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Issues without reproduction steps or code examples may be immediately closed as not actionable. --Link to code example: The bug only happens when you make a change, so if you use the code sandbox link you need, open a new window, active dev tools, open the React dev tools and then uncomment line 5: only then will the error actually happen. I've located the culprit to this line of code And would offer the following change <!-- Please provide a CodeSandbox (), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: --React DevTools is implicitly converting a Symbol to a string. React DevTools does not implicitly try to convert a Symbol to a string.\nThanks for the report. Also reproduced with DevTools version 4.12.3- in Chrome 90 In addition to fixing the bug, it would also be nice to guard against devtools failing so that the UI is unaffected if devtools is faulty. /cc\nYour the best, thanks for a quick turn around!", "commid": "react_issue_21332", "tokennum": 361}], "negative_passages": []} | |
| {"query_id": "q-en-react-847096e512c8ac6d81e2b57a2a45e9c7738a8ed03d4aefc8d3d88e9f7661da24", "query": "\"scriptPreprocessor\": \"scripts/jest/preprocessor.js\", \"setupEnvScriptFile\": \"scripts/jest/environment.js\", \"setupTestFrameworkScriptFile\": \"scripts/jest/test-framework-setup.js\", <ins> \"testRunner\": \"jasmine1\", </ins> \"testFileExtensions\": [ \"coffee\", \"js\",", "positive_passages": [{"docid": "doc-en-react-b73f04f6ef456bbdf4d219ebf9477a9f047106b95ce11985e591af8f740814e5", "text": "Looks like is broken on a fresh checkout. Just doing a and locally results in running jasmine1, but running the same commands on a fresh checkout attempts to run jasmine2 and results in 300+ failing unit tests.", "commid": "react_issue_6198", "tokennum": 45}], "negative_passages": []} | |
| {"query_id": "q-en-react-89f6ad41bb608aa76e5bfa8a414adf2c3657357b5cf38c787f2ac010ca54b5d1", "query": "<div class=\"jsxCompiler\"> <h1>HTML to JSX Compiler</h1> <div id=\"jsxCompiler\"></div> <del> <script src=\"http://reactjs.github.io/react-magic/htmltojsx.min.js\"></script> </del> <ins> <script src=\"https://reactjs.github.io/react-magic/htmltojsx.min.js\"></script> </ins> <script src=\"js/html-jsx.js\"></script> </div>", "positive_passages": [{"docid": "doc-en-react-992788d04eacfdbd9f7506fb810dc3b3a874dac91bdb786726dd5919742f52ba", "text": "! Edits were made last week to this page, maybe it was broken accidentally?\nI guess you use https, but the page loads a script over http and that gets blocked. I made a pull request to fix this . I couldn't test it, so fingers crossed that it is right.\nI though we were going to remove this page and let this live entirely in the react-magic repo?\nThe scripts live in the react-magic repo, but I think we'll keep the page on the React site as it's still really useful there.", "commid": "react_issue_3455", "tokennum": 115}], "negative_passages": []} | |
| {"query_id": "q-en-react-8d35b33f45c3b9cd32106df5f0f8084a8dc2fa11e17086b79dfd8ed2490bdd32", "query": "}); describe('act', () => { <del> it('works', () => { </del> <ins> it('can use .act() to batch updates and effects', () => { </ins> function App(props) { React.useEffect(() => { props.callback();", "positive_passages": [{"docid": "doc-en-react-7f71b422a7c46807c8ad6800cb40555b1545b6633c633ac24a28676df53b6fa9", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug. Behavior regression. What is the current behavior? Package throws when being required in Node. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: What is the expected behavior? should not throw in \"pure\" node (without providing fake document on global). Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? happens on 16.8.0 previous versions work.\nWe also got this issue after upgrading to 16.8.0\nFound the fix and putting together a PR now edit: now on the case", "commid": "react_issue_14764", "tokennum": 210}], "negative_passages": []} | |
| {"query_id": "q-en-react-8e56bb8e4ddc55562a6a2e64bb114543291f1eea1ae72646e5493afb9deec853", "query": "<hr class=\"home-divider\" /> <section class=\"home-bottom-section\"> <div class=\"buttons-unit\"> <del> <a href=\"/getting-started.html\" class=\"button\">Get Started</a> <a href=\"/download.html\" class=\"button\">Download React v{{site.react_version}}</a> </del> <ins> <a href=\"docs/getting-started.html\" class=\"button\">Get Started</a> <a href=\"downloads.html\" class=\"button\">Download React v{{site.react_version}}</a> </ins> </div> </section>", "positive_passages": [{"docid": "doc-en-react-1070c0c3d40fc1e98963a550d678b7fe72dc8f38a07278ff28f395d0dc52b8dc", "text": "<!-- Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest version of the relevant React packages to make sure your issue has not already been fixed. --React version: 16.x <!-- Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Issues without reproduction steps or code examples may be immediately closed as not actionable. --Link to code example: Nothing. It's part of WAI-ARIA 1.3\nI guess the question is what React considers a \"valid\" aria prop: specific version (range) of Aria version with a (WR,CR,PR,REC) spec editors consider the aria prop that ever existed\nYeah, it seems they've support for this fairly recently.\nWe might also ask: \u201cWhy is react telling me what is and isn\u2019t a valid aria attribute.\u201d React isn\u2019t the source of truth for that information. It sounds like the job of a linter rather than something react should warn about.\nI think it might be from a compiler.\nIt's from here:\nWe might also ask: \u201cWhy is react telling me what is and isn\u2019t a valid aria attribute.\u201d The reason is that they're often misspelled so on the whole it's beneficial to warn for unknown ones. I'll merge the PR.\nFixed by Will appear in 18.", "commid": "react_issue_21035", "tokennum": 305}], "negative_passages": []} | |
| {"query_id": "q-en-react-8e56bb8e4ddc55562a6a2e64bb114543291f1eea1ae72646e5493afb9deec853", "query": "<hr class=\"home-divider\" /> <section class=\"home-bottom-section\"> <div class=\"buttons-unit\"> <del> <a href=\"/getting-started.html\" class=\"button\">Get Started</a> <a href=\"/download.html\" class=\"button\">Download React v{{site.react_version}}</a> </del> <ins> <a href=\"docs/getting-started.html\" class=\"button\">Get Started</a> <a href=\"downloads.html\" class=\"button\">Download React v{{site.react_version}}</a> </ins> </div> </section>", "positive_passages": [{"docid": "doc-en-react-98759475c00b98d8dc2646adcf173b66bd82b00106d0b5062c95bd86c16ea2ec", "text": "Not sure if this is intentional, but if I run this: The resulting inner div has its set to . the resulting DOM string is: but if I remove the key the result is: If is used as the key, the result is the latter above.\nThis is intentional. is an intentional value whereas is the lack of a specified value.\nIf that's the case then IMHO we should escape it properly, as it is now and are treated equally by React (this should be trivial by translating it to or whatever. Although personally I'm not sure when it ever makes sense to have as a key, how about a warning too?", "commid": "react_issue_5519", "tokennum": 131}], "negative_passages": []} | |
| {"query_id": "q-en-react-8eb50536e4555f7ff38b9b61c4205d2d40f9876fd74970cecf68cf2d8e423e94", "query": "}); }); <ins> it('should call componentWillUnmount before unmounting', function() { var container = document.createElement('div'); var innerUnmounted = false; spyOn(ReactMount, 'purgeID').andCallThrough(); var Component = React.createClass({ render: function() { return <div> <Inner /> </div>; } }); var Inner = React.createClass({ componentWillUnmount: function() { // It's important that ReactMount.purgeID be called after any component // lifecycle methods, because a componentWillMount implementation is // likely call this.getDOMNode(), which will repopulate the node cache // after it's been cleared, causing a memory leak. expect(ReactMount.purgeID.callCount).toBe(0); innerUnmounted = true; }, render: function() { return <div />; } }); React.renderComponent(<Component />, container); React.unmountComponentAtNode(container); expect(innerUnmounted).toBe(true); // <Component />, <Inner />, and both <div /> elements each call // unmountIDFromEnvironment which calls purgeID, for a total of 4. expect(ReactMount.purgeID.callCount).toBe(4); }); </ins> it('should detect valid CompositeComponent classes', function() { var Component = React.createClass({ render: function() {", "positive_passages": [{"docid": "doc-en-react-303f5589a27626c8ed5d6f0f930b2b84163d1cdd0133511f0a90007b7a44f4fd", "text": "When unmounting components like this: a memory leak happens because ReactMount.getID(node) puts DOM nodes back to nodeCache if they are not there.. just right after they were purged from cache. Here is what's happing when unmounting that example component: label component gets purged from nodeCache when ReactDOMInput component is going to unmount it calls this method: which contains this.getDOMNode() which iterates through the children of the Form element calling getID() on each of them.. which puts these elements back into the cache. So first they were purged and here they are all put back in cache causing a memory leak :( I'm playing with React just 3rd day so not sure of a way to correctly fix this issue\n(I took the liberty to edit your comment to add syntax highlighting)\nI can't reproduce this. With this diff applied, I loaded http://127.0.0.1:8000/examples/ballmer-peak/ in the console and checked -- it was empty. Am I misunderstanding?\nYes. You've missed one more user defined component in there.. Here you go:\nThanks, fixed in .\nThank you for fast fix :)\nThanks for the find/fix!", "commid": "react_issue_781", "tokennum": 272}], "negative_passages": []} | |
| {"query_id": "q-en-react-8f01b6f26551ed4f4f6589e970815783dd769e4f19434bda10e72e49b5863128", "query": "jsxScripts.push(scripts.item(i)); } } console.warn(\"You are using the in-browser JSX transformer. Be sure to precompile your JSX for production - http://facebook.github.io/react/docs/tooling-integration.html#jsx\"); jsxScripts.forEach(function(script) {", "positive_passages": [{"docid": "doc-en-react-54830cbd0e807e9ec25aed786a1e0f731e3699add76f794c7e60bf706c749bf6", "text": "This makes it basically unusable in any nontrivial project. While people shouldn't be using this in production, we should still fix this bug for newbies and people using it for hackathons.\nThis should be relatively easy. What should we do with inline tags?", "commid": "react_issue_393", "tokennum": 57}], "negative_passages": []} | |
| {"query_id": "q-en-react-8faba1735f6b2d17744137e2793573e876d08674a943e100ee050b84816a75af", "query": "function getJSReport(browser){ return browser <del> .waitForCondition(\"typeof window.jasmine != 'undefined'\", 5e3) </del> <ins> .waitFor(wd.asserters.jsCondition(\"typeof window.jasmine != 'undefined'\"), 5e3, 50) </ins> .fail(function(error){ throw Error(\"The test page didn't load properly. \" + error); }) <del> .waitForCondition(\"typeof window.jasmine.getJSReport != 'undefined'\", 10e3) .waitForCondition(\"window.postDataToURL.running <= 0\", 30e3) </del> <ins> .waitFor(wd.asserters.jsCondition(\"typeof window.jasmine.getJSReport != 'undefined'\"), 60e3, 100) .waitFor(wd.asserters.jsCondition(\"window.postDataToURL.running <= 0\"), 30e3, 500) </ins> .eval(\"jasmine.getJSReport().passed\"); }", "positive_passages": [{"docid": "doc-en-react-ab535627950c5c4f6788fdc21c9855588e086629d351666b24466bad463969c7", "text": "Nor sure what that means other than that the tests are flakey :'(\nhttps://travis-\nhttps://travis-", "commid": "react_issue_634", "tokennum": 29}], "negative_passages": []} | |
| {"query_id": "q-en-react-90e017b910fb5f9012c2e55afdd99f1b05388ba147d8c60dda5ced79c8b8198d", "query": "var elementFactory = ReactElement.createFactory(tag); var FullPageComponent = ReactClass.createClass({ <ins> tagName: tag.toUpperCase(), </ins> displayName: 'ReactFullPageComponent' + tag, componentWillUnmount: function() {", "positive_passages": [{"docid": "doc-en-react-083e8ad88e164af524f1d788f1c1f74caee8c62754c5c2a218713aa219c30266", "text": "I\u2019ve tried to update from react 0.12.2 to 0.13.0 which caused several unit tests of my project to fail. I use react to render html on the server side, this includes the basic html structure like , and elements. All unit tests dealing with such elements are failing with react 0.13.0 but they worked fine with 0.12.2. Here is a minimal example : Running this with react 0.12.2, correctly logs the text content of the title:Running this with react 0.13.0 throws a TypeError\nI think this is just a bug, not an intentional breaking change. Thanks for reporting.", "commid": "react_issue_3421", "tokennum": 136}], "negative_passages": []} | |
| {"query_id": "q-en-react-9150e6e06b97d98a03759778bc6d8a868b3498f1682a923e9f7db4eaf18c465d", "query": "expect(idCallOrder[0]).toBe(getID(CHILD)); }); <del> it('should stopPropagation if false is returned', function() { </del> <ins> it('should stopPropagation if false is returned, but warn', function() { </ins> ReactBrowserEventEmitter.putListener( getID(CHILD), ON_CLICK_KEY,", "positive_passages": [{"docid": "doc-en-react-64f27efe9c05b5e90637eacbe11d9aa29892489350fa2c0c136e339a2cc54a88", "text": "We currently support this, but it makes code less understandable and we'd like to stop supporting it and encourage people to use either e.preventDefault() or e.stopPropagation() as appropriate.\n:+1: And then free up the event handler's return value for something else.\nyou mean? :)\nMaybe =) Otherwise we can always use it to indicate something in a potential future event system.", "commid": "react_issue_2015", "tokennum": 90}], "negative_passages": []} | |
| {"query_id": "q-en-react-9281b377d108389dd15f0c22c3d42f704551a6c5b41c0d45c2bc5f0496bdd631", "query": "<ReallyLongErrorMessageThatWillCauseTextToBeTruncated /> <DuplicateWarningsAndErrors /> <MultipleWarningsAndErrors /> <ins> <ComponentWithSymbolWarning /> </ins> </Fragment> ); }", "positive_passages": [{"docid": "doc-en-react-32151ac5f4d8d7fcb6b59730e1224ffe5f513940e4fe6d4c7eec610e94d11802", "text": "<!-- Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest version of the relevant React packages to make sure your issue has not already been fixed. --React version: DevTools version 4.12.2- from within a React component where the last argument is typeof <!-- Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Issues without reproduction steps or code examples may be immediately closed as not actionable. --Link to code example: The bug only happens when you make a change, so if you use the code sandbox link you need, open a new window, active dev tools, open the React dev tools and then uncomment line 5: only then will the error actually happen. I've located the culprit to this line of code And would offer the following change <!-- Please provide a CodeSandbox (), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: --React DevTools is implicitly converting a Symbol to a string. React DevTools does not implicitly try to convert a Symbol to a string.\nThanks for the report. Also reproduced with DevTools version 4.12.3- in Chrome 90 In addition to fixing the bug, it would also be nice to guard against devtools failing so that the UI is unaffected if devtools is faulty. /cc\nYour the best, thanks for a quick turn around!", "commid": "react_issue_21332", "tokennum": 361}], "negative_passages": []} | |
| {"query_id": "q-en-react-94713d3eb40ccac98ab526fc50e8a87bace8011c25a74bacd030f423cf503da8", "query": "if (!styles.hasOwnProperty(styleName)) { continue; } <ins> var styleValue = styles[styleName]; </ins> if (__DEV__) { <del> if (styleName.indexOf('-') > -1) { warnHyphenatedStyleName(styleName); } else if (badVendoredStyleNamePattern.test(styleName)) { warnBadVendoredStyleName(styleName); } </del> <ins> warnValidStyle(styleName, styleValue); </ins> } <del> var styleValue = styles[styleName]; </del> if (styleValue != null) { serialized += processStyleName(styleName) + ':'; serialized += dangerousStyleValue(styleName, styleValue) + ';';", "positive_passages": [{"docid": "doc-en-react-c7e982859a8cdc029effae408c11a8f287f7b31f17233bb05e0078cc7b0bb775", "text": "On the first render it works, but then the update silently fails. Expected would be the semicolon being removed, or an error/warning in the development build. Tested on Chrome latest, Firefox latest, with 0.12.1 and master. Minimal: ran into (on IRC).\nMy first instinct is to put a warning in DEV so we don't incur any costs in prod. This would be similar to our other style key warning (\"you used background-color but probably meant backgroundColor\" or whatever it is we say).\nsounds reasonable, I don't think there's any valid reason to have a semicolon there.\nIt's only a warning, but it's worth considering that is valid CSS IIRC.\nso that wouldn't warn :)\nOh right :), but I've seen plenty of invalid , but perhaps that's an exercise for some other time. Anyway, you might want to ignore white-space after the as well.\nI'm working on this issue. I've a warning, but thinking that it may be a good idea to trim any semicolons as well. The warning will serve to let developers know it's invalid syntax, but try and fix the problem while we're at it.", "commid": "react_issue_2862", "tokennum": 268}], "negative_passages": []} | |
| {"query_id": "q-en-react-9622b1a6989f08c645ef8a7a8f4d0d5d53413bfa0e16afe88eae921e7c1f08a5", "query": "} `, }, <ins> { code: normalizeIndent` export const notAComponent = () => { return () => { useState(); } } `, // TODO: this should error but doesn't. // errors: [functionError('use', 'notAComponent')], }, { code: normalizeIndent` export default () => { if (isVal) { useState(0); } } `, // TODO: this should error but doesn't. // errors: [genericError('useState')], }, { code: normalizeIndent` function notAComponent() { return new Promise.then(() => { useState(); }); } `, // TODO: this should error but doesn't. // errors: [genericError('useState')], }, </ins> ], invalid: [ {", "positive_passages": [{"docid": "doc-en-react-7c6b7cd634d570476502d1781f2d7effe2d2185e88d9fbdc3323463b21686057", "text": "React version: \"eslint-plugin-react-hooks\": \"^4.2.0\" Link to code example: (eslint-plugin-react-hooks) did not fire when it is inside of a Promise block. Please find the detailed explanation in example code below. thx\nHow do you use hooks inside promises? Hooks should only be called in the body of components\nthat is right, but I was not aware of it when I code it. And I think should have caught the error. Can you update the code for to make sure the bug won't fall through the crack? To be specific, the hook I was trying to access inside of promise is , which is about injecting the relay environment to handle the GraphQL query/mutation. Because Eslint did not capture this issue, I merged the bug into production until users complained...\nThis is described in the documentation and any tutorials. I'm not the maintainer of react, but it seems to me that the plugin should not check such things.\nI think this issue is actually the anon function, which is reported here: Leaving this open to confirm fixing anon function fixes this.\nThis issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, \"bump\"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!\nClosing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!", "commid": "react_issue_26186", "tokennum": 358}], "negative_passages": []} | |
| {"query_id": "q-en-react-9622b1a6989f08c645ef8a7a8f4d0d5d53413bfa0e16afe88eae921e7c1f08a5", "query": "} `, }, <ins> { code: normalizeIndent` export const notAComponent = () => { return () => { useState(); } } `, // TODO: this should error but doesn't. // errors: [functionError('use', 'notAComponent')], }, { code: normalizeIndent` export default () => { if (isVal) { useState(0); } } `, // TODO: this should error but doesn't. // errors: [genericError('useState')], }, { code: normalizeIndent` function notAComponent() { return new Promise.then(() => { useState(); }); } `, // TODO: this should error but doesn't. // errors: [genericError('useState')], }, </ins> ], invalid: [ {", "positive_passages": [{"docid": "doc-en-react-12a79a0b1d431bab5b74b762d8ca3d6a1aa22f0675030793feae9d27e7c597e7", "text": "React version: 17.0.2 React-refresh version: 0.10.0 This issue is similar to , but ignores default exported unnamed functions instead. As a code comment suggests, this is a known limitation: Would a fix be considered? Given the following files, making changes to doesn't trigger a re-render. module: module: Making changes to does not re-render the element in . The transformed module does not register the for refresh. Making changes to does re-render the element in .\nThis is intentional \u2014 even if we fix this case, we need some heuristic for other tools like lint rules. Why are you using this style? Functions should have names so that you get them in stack traces and so on.\nIndeed, but then it becomes confusing: If there's no way around, this can be closed and I'll make a suggestion downstream to use The code comment mentioned above should then also be more explicit, replacing \"currently\" by \"intentionally\".\nHowever, given that an ignored component prevents a refresh (), I haven't figured out yet whether this is an issue with itself or with . AFAIK, a code update of an ignored component should still trigger a refresh.\nThis issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, \"bump\"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!\nClosing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!", "commid": "react_issue_21181", "tokennum": 363}], "negative_passages": []} | |
| {"query_id": "q-en-react-98ce93c3aa5ea92f8eeef061c1a47ffd1bb376293c423a735e4427196b313ba2", "query": "findHostInstancesForRefresh, } from './ReactFiberHotReloading.new'; import {markRenderScheduled} from './SchedulingProfiler'; <ins> import ReactVersion from 'shared/ReactVersion'; </ins> export {registerMutableSourceForHydration} from './ReactMutableSource.new'; export {createPortal} from './ReactPortal'; export {", "positive_passages": [{"docid": "doc-en-react-8544d3f8d9a29fb32eabf9f48363d5d52db07eccaeed98a815ae9f22c135bf31", "text": "This is a followup issue for pmndrs/react-three-fiber From my understanding of , the DevTools parse the version number advertised by the renderer in to select how to parse the internal fiber object. Unfortunately this means that third-party renderers that advertise a version lower than the equivalent React version for the release they are using get misclassified: for instance is using which is equivalent to , and since major version is much lower than it uses the default values for the enum which in turns lead to getting identified as and hook inspection being unavailable. A short term solution for renderers is to advertise a React-compatible version number, but ideally this is an implementation detail of the devtools that users of should not have to be aware of (also this means the version number displayed in the devtools is wrong). I'm not sure I'm familiar enough with the internals of the devtools to open a PR for this, but since the version parsing logic is used to detect features that are internal to anyway I guess a solution would be to have the Reconciler package add its own value for the constant along with the parameters sent to the devtools backend, and have the devtools use this string if its available over the renderer version.\nOnce and land (and get released) newer versions of the reconciler will inject its own version (to be used instead of the renderer version). Unfortunately this won't help you until you upgrade.", "commid": "react_issue_21262", "tokennum": 313}], "negative_passages": []} | |
| {"query_id": "q-en-react-a2a4da442c327b4a2d1ac737478dca75b402efb14145b02281e019284612f35c", "query": "onMouseMove onMouseOut onMouseOver onMouseUp ``` <del> Properties: </del> <ins> Properties: </ins> ```javascript boolean altKey", "positive_passages": [{"docid": "doc-en-react-64f27efe9c05b5e90637eacbe11d9aa29892489350fa2c0c136e339a2cc54a88", "text": "We currently support this, but it makes code less understandable and we'd like to stop supporting it and encourage people to use either e.preventDefault() or e.stopPropagation() as appropriate.\n:+1: And then free up the event handler's return value for something else.\nyou mean? :)\nMaybe =) Otherwise we can always use it to indicate something in a potential future event system.", "commid": "react_issue_2015", "tokennum": 90}], "negative_passages": []} | |
| {"query_id": "q-en-react-a91135a233216ad025b910c2d40d8b57bede862e4e31ca57bc002e0143fa4e12", "query": "} var frame = this.stack[this.stack.length - 1]; if (frame.childIndex >= frame.children.length) { <del> out += frame.footer; this.previousWasTextNode = false; </del> <ins> var footer = frame.footer; out += footer; if (footer !== '') { this.previousWasTextNode = false; } </ins> this.stack.pop(); if (frame.tag === 'select') { this.currentSelectValue = null;", "positive_passages": [{"docid": "doc-en-react-ec5ecfe108c5622ae0f0ce83ae6ca196a4c0778b1ab6d72b9b10da2f746acbc9", "text": "Observed this on react This renders as . If you try to hydrate this you'll get the error: Text content did not match. Server: \"bc\" Client: \"b\".\nI suppose the bug here is that we do not separate from here but we should.\nReact has been released. Please update , , and (if you use it) to this version and let us know if it solved the issue! We\u2019d appreciate if you could test before Monday when we plan to get out.\nEverything looks good on my end, thanks!", "commid": "react_issue_10598", "tokennum": 112}], "negative_passages": []} | |
| {"query_id": "q-en-react-ad400f0906a5e58f732417d8e7d1ed2abb683f00ee5391a64760c9f9bd523ef8", "query": "this._instance.context = context; this._instance.props = props; this._instance.state = state; <ins> this._newState = null; </ins> if (shouldUpdate) { this._rendered = this._instance.render();", "positive_passages": [{"docid": "doc-en-react-af6422597abfc3705e1e016cf37e5dbfbfdcf0923b24267ad3eb49d20f8d6064", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug What is the current behavior? In , the shallow renderer will set instance state in so the and will be the same in , which is different with the behavior of real rendering. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: given below class component: render with ReactDOM, the will return true since will be the old value : In shallow renderer, the behavior is different: What is the expected behavior? ShallowRenderer should not set the instance state in getDeriveStateFromProps, or in the we have no way to compare it. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? I have tested this in master branch and 16.3, both not work. By the way this problem is related to airbnb/enzyme . If it's recoginzed as a bug I can provide a PR in next several days.", "commid": "react_issue_14607", "tokennum": 285}], "negative_passages": []} | |
| {"query_id": "q-en-react-ae0cab8fd1b480d7b6aca79ac62277833403598f1fe39ee4f06e5c46fc44eb46", "query": "// 'msTransform' is correct, but the other prefixes should be capitalized var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; <ins> // style values shouldn't contain a semicolon var badStyleValueWithSemicolonPattern = /;s*$/; </ins> var warnedStyleNames = {}; <ins> var warnedStyleValues = {}; </ins> var warnHyphenatedStyleName = function(name) { if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {", "positive_passages": [{"docid": "doc-en-react-c7e982859a8cdc029effae408c11a8f287f7b31f17233bb05e0078cc7b0bb775", "text": "On the first render it works, but then the update silently fails. Expected would be the semicolon being removed, or an error/warning in the development build. Tested on Chrome latest, Firefox latest, with 0.12.1 and master. Minimal: ran into (on IRC).\nMy first instinct is to put a warning in DEV so we don't incur any costs in prod. This would be similar to our other style key warning (\"you used background-color but probably meant backgroundColor\" or whatever it is we say).\nsounds reasonable, I don't think there's any valid reason to have a semicolon there.\nIt's only a warning, but it's worth considering that is valid CSS IIRC.\nso that wouldn't warn :)\nOh right :), but I've seen plenty of invalid , but perhaps that's an exercise for some other time. Anyway, you might want to ignore white-space after the as well.\nI'm working on this issue. I've a warning, but thinking that it may be a good idea to trim any semicolons as well. The warning will serve to let developers know it's invalid syntax, but try and fix the problem while we're at it.", "commid": "react_issue_2862", "tokennum": 268}], "negative_passages": []} | |
| {"query_id": "q-en-react-b2affc878bffb5a3b588c568275b81ceff7a3973515c301fe0cbdaa3a316b9fd", "query": "through2 \"^2.0.0\" fbjs@^0.8.9: <del> version \"0.8.12\" resolved \"https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04\" </del> <ins> version \"0.8.14\" resolved \"https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.14.tgz#d1dbe2be254c35a91e09f31f9cd50a40b2a0ed1c\" </ins> dependencies: core-js \"^1.0.0\" isomorphic-fetch \"^2.1.1\"", "positive_passages": [{"docid": "doc-en-react-e3a52dd5c509e0b69abfb1882d7c573a3a80737013a0b6115656ad61a05c4ff5", "text": "Check that they were a part of the latest internal sync. For stable releases, prefer that they\u2019ve been landed for a week or so. Only skip this step if you really know what you\u2019re doing! [x] You\u2019re in [x] You\u2019re in [x] You\u2019re in [x] You\u2019re in If not, ping someone on the team![x] Ensure you\u2019re on [x] Do a . [x] Check that your local output matches the commit list. [x] Run in the repo root.[x] For : [x] Look at the version range of in root . [x] Ensure all depending on specify the same range. [x] Run in the repo root. (Don\u2019t miss the caret!) [x] For : [x] Look at the version range of in root . [x] Ensure all depending on specify the same range. [x] Run in the repo root. (Don\u2019t miss the caret!) [x] For : [x] Look at the version range of in root . [x] Ensure all depending on specify the same range. [x] Run in the repo root. (Don\u2019t miss the caret!) [x] This might change the lockfile. This should not change any . [x] Commit the changes, if any. (see )[x] Edit: is broken in the 16 branch but this shouldn't block RC, and will be fixed asap by and in [x] Run in the repo root. [x] Run in the repo root. [x] Run in the repo root.[x] Run in the repo root. [x] If changes, [x] Maybe: If we still have a separate branch for docs when you\u2019re reading this, we need to cherry-pick that commit to that branch. This makes sure the website decoder knows about the updated error codes. But ideally we should just change docs to serve from master. (See and ) [x] Update export in [x] Update in all : [x] [x] [x] [x] [x] If you see any other packages, update this list :-) [x] Run to verify your changes. [x][x] Run in the repo root.[x] Open in the browser for a smoke test.", "commid": "react_issue_10623", "tokennum": 508}], "negative_passages": []} | |
| {"query_id": "q-en-react-b2affc878bffb5a3b588c568275b81ceff7a3973515c301fe0cbdaa3a316b9fd", "query": "through2 \"^2.0.0\" fbjs@^0.8.9: <del> version \"0.8.12\" resolved \"https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04\" </del> <ins> version \"0.8.14\" resolved \"https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.14.tgz#d1dbe2be254c35a91e09f31f9cd50a40b2a0ed1c\" </ins> dependencies: core-js \"^1.0.0\" isomorphic-fetch \"^2.1.1\"", "positive_passages": [{"docid": "doc-en-react-29ef57184113a6fc6d83b3b0327ea1e1ef0ba8b29aaee91d2e5434d12686c6b0", "text": "[x] It should say \u201cHello world!\u201d[x] Go to and run [x] [x] Go to the repo root and run [x] Open http://localhost:5000/fixtures/packaging/ and verify every iframe shows \u201cHello World!\u201d[x] Run [x] Run [x] Go to [x] For every subfolder: [x] For non-stable versions: Run in the subfolder. [x] For stable versions: Run in the subfolder.[ ] [ ] [ ]\nw00t~", "commid": "react_issue_10623", "tokennum": 124}], "negative_passages": []} | |
| {"query_id": "q-en-react-b5276e3c025854c96c018a31267cb5065d2dce839b7e3fbc0576c90c1807f5ab", "query": "it(\"should empty element when removing innerHTML\", function() { var stub = ReactTestUtils.renderIntoDocument( <del> <div dangerouslySetInnerHTML={{__html: \":)\"}} /> </del> <ins> <div dangerouslySetInnerHTML={{__html: ':)'}} /> </ins> ); expect(stub.getDOMNode().innerHTML).toEqual(':)');", "positive_passages": [{"docid": "doc-en-react-9306121422e93f6146586d22ff20af2d3e2d2860ed922937e70054809fe064b5", "text": "reported the following issue on IRC: (Both on master and 4.0) The repro case is: 1) Render 2) Render 3) Render the same as 1) The div has its innerHTML empty instead of . I don't really know what's going on. can you guys look at it?\nOne other tidbit: this only seems to happen when the value is exactly the same in step 3 as it was in step 1. If it's different (i.e. ), things work as expected.\nWhat happens if you change step 2 to a instead of a ? It works, right?\nI just reduced the test case to 19 lines.\nyeah changing 2) to use a span works as expected\nIf anyone wants to look into this, the bug is probably here\nI cannot reproduce what you are seeing: It also bugs if I use a different string\nI'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying.\nI know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a property to the React component containing the property. So, does not seem to work reproducibly, whereas seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a statement if that component gets rerendered multiple times with different inner content. Just posting this here in case other people have the same issue and stumble upon this.\nthx you saved my day :-)\nSeems like the issue is back again. Thanks, solves the problem for me too.\nIf any of you can post a simple repro case showing the broken behavior here, I'd be happy to take a look at fixing it.\nTook me a while to repro, but here you go: (ugly, but demonstrates the issue well)\nThanks. This is the same issue as . No fix currently, but using the key as a workaround is fine and I'll see if we can fix this sometime.\nThanks that was giving me fits!\nIf anyone is still seeing issues on 0.14, please make a new issue with a simple repro case.", "commid": "react_issue_377", "tokennum": 469}], "negative_passages": []} | |
| {"query_id": "q-en-react-b5276e3c025854c96c018a31267cb5065d2dce839b7e3fbc0576c90c1807f5ab", "query": "it(\"should empty element when removing innerHTML\", function() { var stub = ReactTestUtils.renderIntoDocument( <del> <div dangerouslySetInnerHTML={{__html: \":)\"}} /> </del> <ins> <div dangerouslySetInnerHTML={{__html: ':)'}} /> </ins> ); expect(stub.getDOMNode().innerHTML).toEqual(':)');", "positive_passages": [{"docid": "doc-en-react-2561d4a0be5f333acf881b6f80c1a973b0d2a5e9e6140ce5d6d62900271a0991", "text": "I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:\nReading out will rarely give you what you put in because the browser does various kinds of normalization on it. If you can repro with a standalone example though I'm happy to take a look.\nwell, that's more like a control shot :-)\nLooks like the issue still exist in 16.4.1 when using on a tag, you cannot nest other or . issue is fixed by replacing the container with a\nIf you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example. when using dangerouslySetInnerHTML on a tag, you cannot nest other or This sounds like browsers work. You can't nest into . This is why React warns when you do it (except in which case React can't validate it).", "commid": "react_issue_377", "tokennum": 312}], "negative_passages": []} | |
| {"query_id": "q-en-react-b8c3b0517f468578990e7a7339ec228395707de3cd69de5b44591f3cb0cc8b94", "query": "expect(result).toEqual(<div>value:1</div>); }); <ins> it('should pass previous state to shouldComponentUpdate even with getDerivedStateFromProps', () => { class SimpleComponent extends React.Component { constructor(props) { super(props); this.state = { value: props.value, }; } static getDerivedStateFromProps(nextProps, prevState) { if (nextProps.value === prevState.value) { return null; } return {value: nextProps.value}; } shouldComponentUpdate(nextProps, nextState) { return nextState.value !== this.state.value; } render() { return <div>{`value:${this.state.value}`}</div>; } } const shallowRenderer = createRenderer(); const initialResult = shallowRenderer.render( <SimpleComponent value=\"initial\" />, ); expect(initialResult).toEqual(<div>value:initial</div>); const updatedResult = shallowRenderer.render( <SimpleComponent value=\"updated\" />, ); expect(updatedResult).toEqual(<div>value:updated</div>); }); </ins> it('can setState with an updater function', () => { let instance;", "positive_passages": [{"docid": "doc-en-react-af6422597abfc3705e1e016cf37e5dbfbfdcf0923b24267ad3eb49d20f8d6064", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug What is the current behavior? In , the shallow renderer will set instance state in so the and will be the same in , which is different with the behavior of real rendering. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: given below class component: render with ReactDOM, the will return true since will be the old value : In shallow renderer, the behavior is different: What is the expected behavior? ShallowRenderer should not set the instance state in getDeriveStateFromProps, or in the we have no way to compare it. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? I have tested this in master branch and 16.3, both not work. By the way this problem is related to airbnb/enzyme . If it's recoginzed as a bug I can provide a PR in next several days.", "commid": "react_issue_14607", "tokennum": 285}], "negative_passages": []} | |
| {"query_id": "q-en-react-bf2111957274c2323d60535fc90eaa001fbba4cd45864a1d75ac2cd55e643bc0", "query": "/** * Same as the default implementation, except cancels the event when return <del> * value is false. </del> <ins> * value is false. This behavior will be disabled in a future release. </ins> * * @param {object} Event to be dispatched. * @param {function} Application-level callback.", "positive_passages": [{"docid": "doc-en-react-64f27efe9c05b5e90637eacbe11d9aa29892489350fa2c0c136e339a2cc54a88", "text": "We currently support this, but it makes code less understandable and we'd like to stop supporting it and encourage people to use either e.preventDefault() or e.stopPropagation() as appropriate.\n:+1: And then free up the event handler's return value for something else.\nyou mean? :)\nMaybe =) Otherwise we can always use it to indicate something in a potential future event system.", "commid": "react_issue_2015", "tokennum": 90}], "negative_passages": []} | |
| {"query_id": "q-en-react-c1468c6f9747d40bb4cd0f1b139cadc9b5e20ead7c597684472de488db53e228", "query": "<a class=\"docs-next\" href=\"/react/docs/{{ page.next }}\">Next →</a> {% endif %} </div> <del> <div class=\"fb-comments\" data-width=\"650\" data-num-posts=\"10\" data-href=\"{{ site.url }}{{ site.baseurl }}{{ page.url }}\"></div> </del> </div> </section>", "positive_passages": [{"docid": "doc-en-react-ca64118bf847d4660407dc0cfa80dc13393c771af4b88e26ffe9546e10663249", "text": "Should those comment sections exist? I'd rather people come to IRC. Their questions are often neglected at the bottom of a doc page.\n:+1: for shutting down comments\n+1\n:+1:", "commid": "react_issue_915", "tokennum": 43}], "negative_passages": []} | |
| {"query_id": "q-en-react-c1a4df081fe5b5160655d7ec209d93c739f0a5a0a4973997ac2d9346705aeee6", "query": "name.charAt(0).toUpperCase() + name.slice(1) + '?' ); }; <ins> var warnStyleValueWithSemicolon = function(name, value) { if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { return; } warnedStyleValues[value] = true; warning( false, 'Style property values shouldn't contain a semicolon. ' + 'Try \"%s: %s\" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '') ); }; /** * @param {string} name * @param {*} value */ var warnValidStyle = function(name, value) { if (name.indexOf('-') > -1) { warnHyphenatedStyleName(name); } else if (badVendoredStyleNamePattern.test(name)) { warnBadVendoredStyleName(name); } else if (badStyleValueWithSemicolonPattern.test(value)) { warnStyleValueWithSemicolon(name, value); } }; </ins> } /**", "positive_passages": [{"docid": "doc-en-react-c7e982859a8cdc029effae408c11a8f287f7b31f17233bb05e0078cc7b0bb775", "text": "On the first render it works, but then the update silently fails. Expected would be the semicolon being removed, or an error/warning in the development build. Tested on Chrome latest, Firefox latest, with 0.12.1 and master. Minimal: ran into (on IRC).\nMy first instinct is to put a warning in DEV so we don't incur any costs in prod. This would be similar to our other style key warning (\"you used background-color but probably meant backgroundColor\" or whatever it is we say).\nsounds reasonable, I don't think there's any valid reason to have a semicolon there.\nIt's only a warning, but it's worth considering that is valid CSS IIRC.\nso that wouldn't warn :)\nOh right :), but I've seen plenty of invalid , but perhaps that's an exercise for some other time. Anyway, you might want to ignore white-space after the as well.\nI'm working on this issue. I've a warning, but thinking that it may be a good idea to trim any semicolons as well. The warning will serve to let developers know it's invalid syntax, but try and fix the problem while we're at it.", "commid": "react_issue_2862", "tokennum": 268}], "negative_passages": []} | |
| {"query_id": "q-en-react-c5e7e616c09a8df01cb00b46b129588cc5f16a21481f36e80ae4278e188152e9", "query": "expect(called).toBe(true); }); <ins> it('warns and throws if you use TestUtils.act instead of TestRenderer.act in node', () => { // we warn when you try to load 2 renderers in the same 'scope' // so as suggested, we call resetModules() to carry on with the test jest.resetModules(); const {act} = require('react-dom/test-utils'); expect(() => { expect(() => act(() => {})).toThrow('document is not defined'); }).toWarnDev( [ 'It looks like you called TestUtils.act(...) in a non-browser environment', ], {withoutStack: 1}, ); }); </ins> }); });", "positive_passages": [{"docid": "doc-en-react-7f71b422a7c46807c8ad6800cb40555b1545b6633c633ac24a28676df53b6fa9", "text": "<!-- Note: if the issue is about documentation or the website, please file it at: --Do you want to request a feature or report a bug? Bug. Behavior regression. What is the current behavior? Package throws when being required in Node. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle () or CodeSandbox () example below: What is the expected behavior? should not throw in \"pure\" node (without providing fake document on global). Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? happens on 16.8.0 previous versions work.\nWe also got this issue after upgrading to 16.8.0\nFound the fix and putting together a PR now edit: now on the case", "commid": "react_issue_14764", "tokennum": 210}], "negative_passages": []} | |
| {"query_id": "q-en-react-c7f781806f41408397145a1d0359ee14f9c6f00fc902bf23f89c51c3d0661fd7", "query": "<ins> ## 4.0.0 * **New Violations:** Consider `PascalCase.useFoo()` calls as Hooks. ([@cyan33](https://github.com/cyan33) in [#18722](https://github.com/facebook/react/pull/18722)) * **New Violations:** Check callback body when it's not written inline. ([@gaearon](https://github.com/gaearon) in [#18435](https://github.com/facebook/react/pull/18435)) * Add a way to enable the dangerous autofix. ([@gaearon](https://github.com/gaearon) in [#18437](https://github.com/facebook/react/pull/18437)) * Offer a more sensible suggestion when encountering an assignment. ([@Zzzen](https://github.com/Zzzen) in [#16784](https://github.com/facebook/react/pull/16784)) * Consider TypeScript casts of `useRef` as constant. ([@sophiebits](https://github.com/sophiebits) in [#18496](https://github.com/facebook/react/pull/18496)) * Add documentation. ([@ghmcadams](https://github.com/ghmcadams) in [#16607](https://github.com/facebook/react/pull/16607)) ## 3.0.0 * **New Violations:** Forbid calling Hooks from classes. ([@ianobermiller](https://github.com/ianobermiller) in [#18341](https://github.com/facebook/react/pull/18341)) * Add a recommended config. ([@SimenB](https://github.com/SimenB) in [#14762](https://github.com/facebook/react/pull/14762)) ## 2.5.0 * Fix a misleading error message in loops. ([@M-Izadmehr](https://github.com/M-Izadmehr) in [#16853](https://github.com/facebook/react/pull/16853)) ## 2.4.0 * **New Violations:** Run checks for functions passed to `forwardRef`. ([@dprgarner](https://github.com/dprgarner) in [#17255](https://github.com/facebook/react/pull/17255)) * **New Violations:** Check for ref usage in any Hook containing the word `Effect`. ([@gaearon](https://github.com/gaearon) in [#17663](https://github.com/facebook/react/pull/17663)) * Disable dangerous autofix and use ESLint Suggestions API instead. ([@wdoug](https://github.com/wdoug) in [#17385](https://github.com/facebook/react/pull/17385)) ## 2.0.0 * **New Violations:** Forbid calling Hooks at the top level. ([@gaearon](https://github.com/gaearon) in [#16455](https://github.com/facebook/react/pull/16455)) * Fix a crash when referencing arguments in arrow functions. ([@hristo-kanchev](https://github.com/hristo-kanchev) in [#16356](https://github.com/facebook/react/pull/16356)) ## 1.x The 1.x releases aren\u2019t noted in this changelog, but you can find them in the [commit history](https://github.com/facebook/react/commits/master/packages/eslint-plugin-react-hooks). </ins>", "positive_passages": [{"docid": "doc-en-react-93a11fe4313739e08856e20853f01263ec596ff838644c102f9395167f3bcb37", "text": "<!-- Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest version of the relevant React packages to make sure your issue has not already been fixed. --React version: eslint-plugin-react-hooks to Releases on GitHub there about eslint-plugin-react-hooks to look for a CHANGELOG for eslint-plugin-react-hooks CHANGELOG <!-- Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Issues without reproduction steps or code examples may be immediately closed as not actionable. --Link to code example: Not code related. <!-- Please provide a CodeSandbox (), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: --No change logs. Change logs on the Releases page for eslint-plugin-react-hooks or a separate CHANGELOG. Especially for major version changes so developers are aware of breaking changes that need to be fixed/prioritised. Thank you.\nPlease feel free to help out filling that in. Thanks!\nThanks. I tried searching for an existing issue but couldn't find one so I thought I'd mention it. I've gone through the commit history (standard process without release notes) but without existing knowledge of the codebase, it's a bit hard to understand what changes affect the user and how. So I'll leave someone more in-the-know to write it. :bowing_man:", "commid": "react_issue_18494", "tokennum": 371}], "negative_passages": []} | |
| {"query_id": "q-en-react-cbc0b580e3bb55cda19639a54ac1f9fd9455fbc78d872d5f1640d1fd91e16675", "query": "}); }); <ins> describe('comparing jsx vs .createFactory() vs .createElement()', function() { var Child, mocks; beforeEach(function() { require('mock-modules').dumpCache(); mocks = require('mocks'); React = require('React'); ReactDOM = require('ReactDOM'); ReactTestUtils = require('ReactTestUtils'); var metaData = mocks.getMetadata(React.createClass({ render: function() { return React.createElement('div'); }, })); Child = mocks.generateFromMetadata(metaData); }); describe('when using jsx only', function() { var Parent, instance; beforeEach(function() { Parent = React.createClass({ render: function() { return ( <div> <Child ref=\"child\" foo=\"foo value\">children value</Child> </div> ); }, }); instance = ReactTestUtils.renderIntoDocument(<Parent/>); }); it('should scry children but cannot', function() { var children = ReactTestUtils.scryRenderedComponentsWithType(instance, Child); expect(children.length).toBe(1); }); it('does not maintain refs', function() { expect(instance.refs.child).not.toBeUndefined(); }); it('can capture Child instantiation calls', function() { expect(Child.mock.calls[0][0]).toEqual({ foo: 'foo value', children: 'children value' }); }); }); describe('when using parent that uses .createFactory()', function() { var factory, instance; beforeEach(function() { var childFactory = React.createFactory(Child); var Parent = React.createClass({ render: function() { return React.DOM.div({}, childFactory({ ref: 'child', foo: 'foo value' }, 'children value')); }, }); factory = React.createFactory(Parent); instance = ReactTestUtils.renderIntoDocument(factory()); }); it('can properly scry children', function() { var children = ReactTestUtils.scryRenderedComponentsWithType(instance, Child); expect(children.length).toBe(1); }); it('does not maintain refs', function() { expect(instance.refs.child).not.toBeUndefined(); }); it('can capture Child instantiation calls', function() { expect(Child.mock.calls[0][0]).toEqual({ foo: 'foo value', children: 'children value' }); }); }); describe('when using parent that uses .createElement()', function() { var factory, instance; beforeEach(function() { var Parent = React.createClass({ render: function() { return React.DOM.div({}, React.createElement(Child, { ref: 'child', foo: 'foo value' }, 'children value')); }, }); factory = React.createFactory(Parent); instance = ReactTestUtils.renderIntoDocument(factory()); }); it('should scry children but cannot', function() { var children = ReactTestUtils.scryRenderedComponentsWithType(instance, Child); expect(children.length).toBe(1); }); it('does not maintain refs', function() { expect(instance.refs.child).not.toBeUndefined(); }); it('can capture Child instantiation calls', function() { expect(Child.mock.calls[0][0]).toEqual({ foo: 'foo value', children: 'children value' }); }); }); }); </ins>", "positive_passages": [{"docid": "doc-en-react-e2c9d21a071cff3da64ba945cce5c2773214a1b432cc845d9456267fd227cfc0", "text": "I've created a repo to help illustrate what I'm running into: Basically, developing in pure jsx and using the React.createFactory() are not interchangeable under testing using jest. This makes writing unit tests a little trickier. According to this link: , non-jsx components must be wrapped in a React.createFactory(). But, when testing these components using Jest, I've found that these are not interchangeable within tests that mock sub-modules. I'm guessing that the differences stem from using .bind() within React.createFactory:\nupdated the aforementioned repo with some possible workarounds. hopefully it saves someone else some time. perhaps the documentation can be expanded with an example.\ncc\nFirst of all, thank you for an excellent bug report. Very well structured and easy to test. The bad news is that the various wrappers and undoing of wrappers is very complex. It was difficult to get 0.12 into a form where it was a perfect upgrade path. I guess this is a special case where something broke down. I ended up spending a lot of time on this so I'm inclined to just leave 0.12 as broken. :/ The good news is that this works in the master branch so this will be fixed in 0.13. Would you mind submitting a formal pull request with these unit tests to our tests to ensure that it doesn't break again? The exception is asserting on props on mockComponent. We probably won't support that. is considered legacy at this point. It shouldn't be as important in 0.13, since auto-mocked components works better out-of-the-box. We'll probably encourage shallow testing for this use case.\ni'll do my best to get the tests into a PR for your test suite. But, fighting some fires at the moment, so I can't promise a drop date. Thanks for looking into it.\nClosing as very outdated.", "commid": "react_issue_2576", "tokennum": 414}], "negative_passages": []} | |
| {"query_id": "q-en-react-cbec4e8b3231fe0a9a4359eac227c48acd9ee2d0ba0860cf29ff6cb8b5bde2f6", "query": "var invariant = require('invariant'); var keyOf = require('keyOf'); <ins> var warning = require('warning'); </ins> var topLevelTypes = EventConstants.topLevelTypes;", "positive_passages": [{"docid": "doc-en-react-64f27efe9c05b5e90637eacbe11d9aa29892489350fa2c0c136e339a2cc54a88", "text": "We currently support this, but it makes code less understandable and we'd like to stop supporting it and encourage people to use either e.preventDefault() or e.stopPropagation() as appropriate.\n:+1: And then free up the event handler's return value for something else.\nyou mean? :)\nMaybe =) Otherwise we can always use it to indicate something in a potential future event system.", "commid": "react_issue_2015", "tokennum": 90}], "negative_passages": []} | |
| {"query_id": "q-en-react-cc517894686d322e0991eb59626b2491a10558af6a782f6ba66d0659ea95b699", "query": "> lightweight description of what the DOM should look like. We call this process **reconciliation**. Check out <del> [this jsFiddle](http://jsfiddle.net/fv6RD/3/) to see an example of </del> <ins> [this jsFiddle](http://jsfiddle.net/2h6th4ju/) to see an example of </ins> reconciliation in action. Because this re-render is so fast (around 1ms for TodoMVC), the developer", "positive_passages": [{"docid": "doc-en-react-cdf43bc5ea0b86f1f044d355773507075b88090b6da9c49f5e05980ac771e10f", "text": "Do you want to request a feature or report a bug? bug What is the current behavior? does not work, the code is not executed, there are two files loaded from the Facebook servers but they both return a 5xx error If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via or similar (template: ). Go to and then click the link at the bottom to go to and then click on the link to jsfiddle in the text What is the expected behavior? that there is some generated output in the result pane Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? Chrome (latest stable, Mac OS), Safari (Mac OS)\nThat\u2019s a pretty old blogpost. I\u2019m not sure why the integration broke, but I recommend to look at more modern examples (e.g. is up to date).\nWell, this blogpost is still linked at the bottom here: So this is how I came there. By reading the guide and I thought I would get an uptodate guide with uptodate links ;-)\nFixed now. The new link is It will appear in the blog post the next time we sync our docs. Thanks!\nGreat. Thanks too.", "commid": "react_issue_7782", "tokennum": 273}], "negative_passages": []} | |
| {"query_id": "q-en-react-cf3d7a26c529e5920d38acc56b78ad0e4fd02429a8067ef39f9d0088e6b6371e", "query": "this._defaultProps = null; <del> ReactComponent.Mixin.unmountComponent.call(this); </del> this._renderedComponent.unmountComponent(); this._renderedComponent = null; <ins> ReactComponent.Mixin.unmountComponent.call(this); </ins> if (this.refs) { this.refs = null; }", "positive_passages": [{"docid": "doc-en-react-303f5589a27626c8ed5d6f0f930b2b84163d1cdd0133511f0a90007b7a44f4fd", "text": "When unmounting components like this: a memory leak happens because ReactMount.getID(node) puts DOM nodes back to nodeCache if they are not there.. just right after they were purged from cache. Here is what's happing when unmounting that example component: label component gets purged from nodeCache when ReactDOMInput component is going to unmount it calls this method: which contains this.getDOMNode() which iterates through the children of the Form element calling getID() on each of them.. which puts these elements back into the cache. So first they were purged and here they are all put back in cache causing a memory leak :( I'm playing with React just 3rd day so not sure of a way to correctly fix this issue\n(I took the liberty to edit your comment to add syntax highlighting)\nI can't reproduce this. With this diff applied, I loaded http://127.0.0.1:8000/examples/ballmer-peak/ in the console and checked -- it was empty. Am I misunderstanding?\nYes. You've missed one more user defined component in there.. Here you go:\nThanks, fixed in .\nThank you for fast fix :)\nThanks for the find/fix!", "commid": "react_issue_781", "tokennum": 272}], "negative_passages": []} | |
| {"query_id": "q-en-react-da82db36cff2f8fd8a79f4f349eaa280e9ab783ad80f56092dd2a24e1dac0c82", "query": "* **Computed data:** Don't worry about precomputing values based on state \u2014 it's easier to ensure that your UI is consistent if you do all computation within `render()`. For example, if you have an array of list items in state and you want to render the count as a string, simply render `this.state.listItems.length + ' list items'` in your `render()` method rather than storing it on state. * **React components:** Build them in `render()` based on underlying props and state. <del> * **Duplicated data from props:** Try to use props as the source of truth where possible. Because props can change over time, it's appropriate to store props in state to be able to know its previous values. </del> <ins> * **Duplicated data from props:** Try to use props as the source of truth where possible. One valid use to store props in state is to be able to know it's previous values, because props can change over time. </ins>", "positive_passages": [{"docid": "doc-en-react-1e38296c0b68c1189567645d4bee40dd42c6efa1fd20400a01c82d0a5ffab32c", "text": "At the end, there is a confusing explanation about \"Duplicated data from props\" in the section \"What Shouldn\u2019t Go in State?\": Perhaps what is trying to be said is something like:\nAh, perhaps what they're really referring to is basically \"edit pages\", where you might want to diff the before and after, so that you can send only the changed variables. But it really reads quite weirdly, especially for beginners.\nThis change is needed. I'm new to React and just did a Google search on that part of the documentation for clarification and it came up with this page. I'm guessing that what you've interpreted it to mean is correct, as it makes sense that way.", "commid": "react_issue_1883", "tokennum": 152}], "negative_passages": []} | |
| {"query_id": "q-en-react-e01cf8de883d64797435f8e070b494a5eb994cd001b0b27d1ca17d16bf9f43e3", "query": "``` onClick onDoubleClick onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown onMouseEnter onMouseLeave <del> onMouseMove onMouseUp </del> <ins> onMouseMove onMouseOut onMouseOver onMouseUp </ins> ``` Properties:", "positive_passages": [{"docid": "doc-en-react-7e215142cfee41f3a5c9f3a4523ae6786642b4cde53fcef8da4414036dde1206", "text": "Someone had the trouble in IRC about it. Edit: changed the subject from \"document it\" to \"support it\", because the documentation issue is already at .\nBetter yet, support it!\nYeah, is there a particular reason it's not supported?\nCurious if you've seen the . It's automatically injected into React by default, so you can use it today. IMHO it's (much) better than . (I suppose we could support just for the sake of completeness, but I thought I'd just make sure you guys were aware of .)\nWe discussed this for a bit on IRC -- was just confused that silently didn't work whereas other events did -- perhaps adding more documentation () will fix the problem too but it seems like we might as well add for completeness. (I agree that enter/leave are much more useful and suggested that over/out are likely missing simply because no one has needed them!)\nAgree - I believe there are a few extra allocations (not-pooled) occuring in the event system already today. I'd love to track those down before adding more mouse-move event allocations. If you open the memory profiler in Chrome and move the mouse around, you'll see memory being allocated (and then properly freed of course) but if we use es everywhere, we should be flat. That would make me much more comfortable with adding to . Edit: Just checked out - we already have which fires way more frequently than would so it's probably not such a big deal to add - though we really should get rid of all additional allocations in the event path.\nJust started to look a little bit into the allocations here. Redefining trapBubbledEvent in ReactEventEmitter with: still shows allocations in the Chrome memory timeline view, so I'm not convinced that there's anything we can do here? (Replacing trapBubbledEvent itself with a noop makes the allocations go away. simply calls addEventListener.)\nI am pretty sure we have done all we can here -- at least I think we've tracked down every callsite where PooledClass would have helped us. I updated our recast transforms to log every syntax construct that would cause an obvious allocation and couldn't find anything. I was thinking maybe there was an array slice or a bind() in there, but experiment shows that this is not the case.", "commid": "react_issue_340", "tokennum": 509}], "negative_passages": []} | |
| {"query_id": "q-en-react-e01cf8de883d64797435f8e070b494a5eb994cd001b0b27d1ca17d16bf9f43e3", "query": "``` onClick onDoubleClick onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown onMouseEnter onMouseLeave <del> onMouseMove onMouseUp </del> <ins> onMouseMove onMouseOut onMouseOver onMouseUp </ins> ``` Properties:", "positive_passages": [{"docid": "doc-en-react-ac434d767083ac836e19c967390cf16739cdb96c2a1d7993c7c103db6b357686", "text": "(I didn't verify that we don't have more allocations than the empty-function case; I don't know of a good way to do so.)\nI might be misinformed, but isn't there quite a difference in use cases between mouseenter and mouseover events? Here's a theoretical (non-react) example working with some hover states for nested elements: I tried to apply the above concept in react (with nested components) using onMouseEnter instead, but it obviously fails because it's only triggered once on the top-most element. Moving into a child element and back has no effect. Maybe there's a better approach for this in react altogether?\nIf you render the child hierarchy with React, you can listen to on each child element you are interested in instead of using event bubbling. It is cheap.", "commid": "react_issue_340", "tokennum": 179}], "negative_passages": []} | |
| {"query_id": "q-en-react-e04b396dc266aa2a900be31e6e6fcf8bd605749fb7aea73a275fda72365f2cc7", "query": "'n in Child (at **)n in Intermediate (at **)n in Parent (at **)', ); }); <ins> it('should correctly log Symbols', () => { const Component = ({children}) => { fakeConsole.warn('Symbol:', Symbol('')); return null; }; act(() => ReactDOM.render(<Component />, document.createElement('div'))); expect(mockWarn).toHaveBeenCalledTimes(1); expect(mockWarn.mock.calls[0][0]).toBe('Symbol:'); }); </ins> });", "positive_passages": [{"docid": "doc-en-react-32151ac5f4d8d7fcb6b59730e1224ffe5f513940e4fe6d4c7eec610e94d11802", "text": "<!-- Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest version of the relevant React packages to make sure your issue has not already been fixed. --React version: DevTools version 4.12.2- from within a React component where the last argument is typeof <!-- Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Issues without reproduction steps or code examples may be immediately closed as not actionable. --Link to code example: The bug only happens when you make a change, so if you use the code sandbox link you need, open a new window, active dev tools, open the React dev tools and then uncomment line 5: only then will the error actually happen. I've located the culprit to this line of code And would offer the following change <!-- Please provide a CodeSandbox (), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: --React DevTools is implicitly converting a Symbol to a string. React DevTools does not implicitly try to convert a Symbol to a string.\nThanks for the report. Also reproduced with DevTools version 4.12.3- in Chrome 90 In addition to fixing the bug, it would also be nice to guard against devtools failing so that the UI is unaffected if devtools is faulty. /cc\nYour the best, thanks for a quick turn around!", "commid": "react_issue_21332", "tokennum": 361}], "negative_passages": []} | |
| {"query_id": "q-en-react-e294f92462df05a7ac45349aff35915a9c38a9a6ef490b84db25e9e643634f54", "query": "// Relies on `updateStylesByID` not mutating `styleUpdates`. styleUpdates = nextProp; } <del> } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { var lastHtml = lastProp && lastProp.__html; var nextHtml = nextProp && nextProp.__html; if (lastHtml !== nextHtml) { ReactComponent.DOMIDOperations.updateInnerHTMLByID( this._rootNodeID, nextProp ); } </del> } else if (registrationNames[propKey]) { putListener(this._rootNodeID, propKey, nextProp); } else if (", "positive_passages": [{"docid": "doc-en-react-9306121422e93f6146586d22ff20af2d3e2d2860ed922937e70054809fe064b5", "text": "reported the following issue on IRC: (Both on master and 4.0) The repro case is: 1) Render 2) Render 3) Render the same as 1) The div has its innerHTML empty instead of . I don't really know what's going on. can you guys look at it?\nOne other tidbit: this only seems to happen when the value is exactly the same in step 3 as it was in step 1. If it's different (i.e. ), things work as expected.\nWhat happens if you change step 2 to a instead of a ? It works, right?\nI just reduced the test case to 19 lines.\nyeah changing 2) to use a span works as expected\nIf anyone wants to look into this, the bug is probably here\nI cannot reproduce what you are seeing: It also bugs if I use a different string\nI'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying.\nI know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a property to the React component containing the property. So, does not seem to work reproducibly, whereas seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a statement if that component gets rerendered multiple times with different inner content. Just posting this here in case other people have the same issue and stumble upon this.\nthx you saved my day :-)\nSeems like the issue is back again. Thanks, solves the problem for me too.\nIf any of you can post a simple repro case showing the broken behavior here, I'd be happy to take a look at fixing it.\nTook me a while to repro, but here you go: (ugly, but demonstrates the issue well)\nThanks. This is the same issue as . No fix currently, but using the key as a workaround is fine and I'll see if we can fix this sometime.\nThanks that was giving me fits!\nIf anyone is still seeing issues on 0.14, please make a new issue with a simple repro case.", "commid": "react_issue_377", "tokennum": 469}], "negative_passages": []} | |
| {"query_id": "q-en-react-e294f92462df05a7ac45349aff35915a9c38a9a6ef490b84db25e9e643634f54", "query": "// Relies on `updateStylesByID` not mutating `styleUpdates`. styleUpdates = nextProp; } <del> } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { var lastHtml = lastProp && lastProp.__html; var nextHtml = nextProp && nextProp.__html; if (lastHtml !== nextHtml) { ReactComponent.DOMIDOperations.updateInnerHTMLByID( this._rootNodeID, nextProp ); } </del> } else if (registrationNames[propKey]) { putListener(this._rootNodeID, propKey, nextProp); } else if (", "positive_passages": [{"docid": "doc-en-react-2561d4a0be5f333acf881b6f80c1a973b0d2a5e9e6140ce5d6d62900271a0991", "text": "I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:\nReading out will rarely give you what you put in because the browser does various kinds of normalization on it. If you can repro with a standalone example though I'm happy to take a look.\nwell, that's more like a control shot :-)\nLooks like the issue still exist in 16.4.1 when using on a tag, you cannot nest other or . issue is fixed by replacing the container with a\nIf you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example. when using dangerouslySetInnerHTML on a tag, you cannot nest other or This sounds like browsers work. You can't nest into . This is why React warns when you do it (except in which case React can't validate it).", "commid": "react_issue_377", "tokennum": 312}], "negative_passages": []} | |
| {"query_id": "q-en-react-e4651c7bdd4e33adebf23c307fa8160bfda0845fef08537260b1a4065bb863d8", "query": "runScripts = function() { var scripts = document.getElementsByTagName('script'); // Array.prototype.slice cannot be used on NodeList on IE8 var jsxScripts = []; for (var i = 0; i < scripts.length; i++) {", "positive_passages": [{"docid": "doc-en-react-54830cbd0e807e9ec25aed786a1e0f731e3699add76f794c7e60bf706c749bf6", "text": "This makes it basically unusable in any nontrivial project. While people shouldn't be using this in production, we should still fix this bug for newbies and people using it for hackathons.\nThis should be relatively easy. What should we do with inline tags?", "commid": "react_issue_393", "tokennum": 57}], "negative_passages": []} | |
| {"query_id": "q-en-react-e6c01ea97c564474be805fdad74db5685bf9ce4255d54884d8cedf7955742ada", "query": "For the remainder of this tutorial, we'll be writing our JavaScript code in this script tag. <ins> > Note: > > We included jQuery here because we want to simplify the code of our future ajax calls, but it's **NOT** mandatory for React to work. </ins> ### Your first component React is all about modular, composable components. For our comment box example, we'll have the following component structure:", "positive_passages": [{"docid": "doc-en-react-9a4c17119b72486acbc256acc12363b8fd4d52fa529b03236f80736e3d383129", "text": "This may be controversial, but after browsing StackOverflow I believe there's way too many people that load jQuery when they really don't need it. Let's not add to that. I don't think we should be loading jQuery in the tutorial just to do an AJAX request. Let's instead have a dummy object that just returns a static list. Which could simply be replaced to implement AJAX loading. Old post (before I thought of just using static data): Let's replace it with standard XMLHttpRequest code and say something like \"Here's some simple code for doing an AJAX request, alternatively you could use your favourite framework like jQuery, MooTools, YUI, ... instead\". Having jQuery loaded in the tutorial may make people think that jQuery is necessary to use React.\nI was thinking about this more and using a static list would probably be better than AJAX (given the tutorial just AJAX loads a static file). Updated the description to reflect this.\nI think that would be fine. I would still put the equivalent jQuery call because that will be the inevitable question.\nAfter reading pretty much everything related to this issue, I think it would be a good idea to add (for now) a little note in the tutorial, just under the code snippet having the jQuery inclusion. I think it's the only place it really needs to be. What do you think ? (So we can finally close this issue)\nAgreed. A beginner tutorial isn't the place to debate jquery vs no jquery. The point is familiarity.\nFor what it's worth, I removed the use of jQuery in the ReactJS.NET version of the tutorial:\n^ The note about jQuery not being mandatory got merged. I think this is good for now for newcomers. The react users probably already realized they don't actually need jQuery. Closing for now! =)\nIt dose not look very good when you are introducing new people to React and the first ting in the tutorial is: \"We need to do some Ajax calls, let's just add jQuery\".", "commid": "react_issue_603", "tokennum": 461}], "negative_passages": []} | |
| {"query_id": "q-en-react-ec3a6bbc822b94b72de6a74f9500a45c2ce38e59e006b982b2726572053a553e", "query": "}, /** <del> * Updates a DOM node's innerHTML set by `props.dangerouslySetInnerHTML`. </del> <ins> * Updates a DOM node's innerHTML. </ins> * * @param {string} id ID of the node to update. <del> * @param {object} html An HTML object with the `__html` property. </del> <ins> * @param {string} html An HTML string. </ins> * @internal */ updateInnerHTMLByID: function(id, html) { var node = ReactMount.getNode(id); // HACK: IE8- normalize whitespace in innerHTML, removing leading spaces. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html <del> node.innerHTML = (html && html.__html || '').replace(/^ /g, ' '); </del> <ins> node.innerHTML = html.replace(LEADING_SPACE, ' '); </ins> }, /**", "positive_passages": [{"docid": "doc-en-react-9306121422e93f6146586d22ff20af2d3e2d2860ed922937e70054809fe064b5", "text": "reported the following issue on IRC: (Both on master and 4.0) The repro case is: 1) Render 2) Render 3) Render the same as 1) The div has its innerHTML empty instead of . I don't really know what's going on. can you guys look at it?\nOne other tidbit: this only seems to happen when the value is exactly the same in step 3 as it was in step 1. If it's different (i.e. ), things work as expected.\nWhat happens if you change step 2 to a instead of a ? It works, right?\nI just reduced the test case to 19 lines.\nyeah changing 2) to use a span works as expected\nIf anyone wants to look into this, the bug is probably here\nI cannot reproduce what you are seeing: It also bugs if I use a different string\nI'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying.\nI know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a property to the React component containing the property. So, does not seem to work reproducibly, whereas seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a statement if that component gets rerendered multiple times with different inner content. Just posting this here in case other people have the same issue and stumble upon this.\nthx you saved my day :-)\nSeems like the issue is back again. Thanks, solves the problem for me too.\nIf any of you can post a simple repro case showing the broken behavior here, I'd be happy to take a look at fixing it.\nTook me a while to repro, but here you go: (ugly, but demonstrates the issue well)\nThanks. This is the same issue as . No fix currently, but using the key as a workaround is fine and I'll see if we can fix this sometime.\nThanks that was giving me fits!\nIf anyone is still seeing issues on 0.14, please make a new issue with a simple repro case.", "commid": "react_issue_377", "tokennum": 469}], "negative_passages": []} | |
| {"query_id": "q-en-react-ec3a6bbc822b94b72de6a74f9500a45c2ce38e59e006b982b2726572053a553e", "query": "}, /** <del> * Updates a DOM node's innerHTML set by `props.dangerouslySetInnerHTML`. </del> <ins> * Updates a DOM node's innerHTML. </ins> * * @param {string} id ID of the node to update. <del> * @param {object} html An HTML object with the `__html` property. </del> <ins> * @param {string} html An HTML string. </ins> * @internal */ updateInnerHTMLByID: function(id, html) { var node = ReactMount.getNode(id); // HACK: IE8- normalize whitespace in innerHTML, removing leading spaces. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html <del> node.innerHTML = (html && html.__html || '').replace(/^ /g, ' '); </del> <ins> node.innerHTML = html.replace(LEADING_SPACE, ' '); </ins> }, /**", "positive_passages": [{"docid": "doc-en-react-2561d4a0be5f333acf881b6f80c1a973b0d2a5e9e6140ce5d6d62900271a0991", "text": "I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:\nReading out will rarely give you what you put in because the browser does various kinds of normalization on it. If you can repro with a standalone example though I'm happy to take a look.\nwell, that's more like a control shot :-)\nLooks like the issue still exist in 16.4.1 when using on a tag, you cannot nest other or . issue is fixed by replacing the container with a\nIf you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example. when using dangerouslySetInnerHTML on a tag, you cannot nest other or This sounds like browsers work. You can't nest into . This is why React warns when you do it (except in which case React can't validate it).", "commid": "react_issue_377", "tokennum": 312}], "negative_passages": []} | |
| {"query_id": "q-en-react-eee248b139a4947341f76469752352207db9b338ac7aa08a28c22aeda9799eea", "query": "'use strict'; <ins> var path = require(\"path\"); </ins> var grunt = require(\"grunt\"); var expand = grunt.file.expand; var spawn = grunt.util.spawn;", "positive_passages": [{"docid": "doc-en-react-459d94b9ffcb633b04e63503fb6f939599a3860d53fc82065a5b90ffa4d8464d", "text": "H:githubreactgrunt Running \"delete-build-modules\" task Running \"jsx:normal\" (jsx) task Warning: This socket is closed. Use --force to continue. Aborted due to warnings. on windows. any hint?\nThe issue arises in the jsx task at line 42: File: [no files] Warning: This socket is closed. Use --force to continue. Error: This socket is closed. at () at doWrite () at writeOrBuffer () at () at () at (c:reactgrunttasks) at Object.<anonymous(c:reactnodemodulesgruntlibgrunt) at (c:reactnodemodulesgruntlibgrunt) at Object.<anonymous(c:reactnodemodulesgruntlibutil) at Task.runTaskFn (c:reactnode_modulesgruntlibutil) var child = spawn({ cmd: \"bin/jsx-internal\", args: args }, function(error, result, code) { if (error) { (error); done(false); } else { done(); } }); (JSON.stringify(config.getConfig())); So, looks like the spawn child's input stream is not available. Running node bin/jsx-internal\" works however, get a message saying \"Warning: still waiting for STDIN after 1000ms\"\n- can you take a look?\nI was able to work around this by changing the following in grunttasks to Obviously this change is Windows-only but does provide a possible workaround.\nWhat about changing it to\nYes, I can verify that worked on my machine. Sorry, I used some leftover code for executing batch files which requires going through cmd.\nCool, I can put up a PR for that (unless you have the time,\nSure, I can do that. Thanks for the help!", "commid": "react_issue_1292", "tokennum": 451}], "negative_passages": []} | |
| {"query_id": "q-en-react-f137cc7dcf1c140ebdd91e96706ca8a75c9fcce4e355193f02685611615cc659", "query": "continue; } if (__DEV__) { <del> if (styleName.indexOf('-') > -1) { warnHyphenatedStyleName(styleName); } else if (badVendoredStyleNamePattern.test(styleName)) { warnBadVendoredStyleName(styleName); } </del> <ins> warnValidStyle(styleName, styles[styleName]); </ins> } var styleValue = dangerousStyleValue(styleName, styles[styleName]); if (styleName === 'float') {", "positive_passages": [{"docid": "doc-en-react-c7e982859a8cdc029effae408c11a8f287f7b31f17233bb05e0078cc7b0bb775", "text": "On the first render it works, but then the update silently fails. Expected would be the semicolon being removed, or an error/warning in the development build. Tested on Chrome latest, Firefox latest, with 0.12.1 and master. Minimal: ran into (on IRC).\nMy first instinct is to put a warning in DEV so we don't incur any costs in prod. This would be similar to our other style key warning (\"you used background-color but probably meant backgroundColor\" or whatever it is we say).\nsounds reasonable, I don't think there's any valid reason to have a semicolon there.\nIt's only a warning, but it's worth considering that is valid CSS IIRC.\nso that wouldn't warn :)\nOh right :), but I've seen plenty of invalid , but perhaps that's an exercise for some other time. Anyway, you might want to ignore white-space after the as well.\nI'm working on this issue. I've a warning, but thinking that it may be a good idea to trim any semicolons as well. The warning will serve to let developers know it's invalid syntax, but try and fix the problem while we're at it.", "commid": "react_issue_2862", "tokennum": 268}], "negative_passages": []} | |
| {"query_id": "q-en-react-f3a060b60bc1bfaf97e0fada063de08b8ca79162b8b597f8126df0beda66ecf2", "query": "topKeyUp: eventTypes.keyUp, topMouseDown: eventTypes.mouseDown, topMouseMove: eventTypes.mouseMove, <ins> topMouseOut: eventTypes.mouseOut, topMouseOver: eventTypes.mouseOver, </ins> topMouseUp: eventTypes.mouseUp, topPaste: eventTypes.paste, topScroll: eventTypes.scroll,", "positive_passages": [{"docid": "doc-en-react-7e215142cfee41f3a5c9f3a4523ae6786642b4cde53fcef8da4414036dde1206", "text": "Someone had the trouble in IRC about it. Edit: changed the subject from \"document it\" to \"support it\", because the documentation issue is already at .\nBetter yet, support it!\nYeah, is there a particular reason it's not supported?\nCurious if you've seen the . It's automatically injected into React by default, so you can use it today. IMHO it's (much) better than . (I suppose we could support just for the sake of completeness, but I thought I'd just make sure you guys were aware of .)\nWe discussed this for a bit on IRC -- was just confused that silently didn't work whereas other events did -- perhaps adding more documentation () will fix the problem too but it seems like we might as well add for completeness. (I agree that enter/leave are much more useful and suggested that over/out are likely missing simply because no one has needed them!)\nAgree - I believe there are a few extra allocations (not-pooled) occuring in the event system already today. I'd love to track those down before adding more mouse-move event allocations. If you open the memory profiler in Chrome and move the mouse around, you'll see memory being allocated (and then properly freed of course) but if we use es everywhere, we should be flat. That would make me much more comfortable with adding to . Edit: Just checked out - we already have which fires way more frequently than would so it's probably not such a big deal to add - though we really should get rid of all additional allocations in the event path.\nJust started to look a little bit into the allocations here. Redefining trapBubbledEvent in ReactEventEmitter with: still shows allocations in the Chrome memory timeline view, so I'm not convinced that there's anything we can do here? (Replacing trapBubbledEvent itself with a noop makes the allocations go away. simply calls addEventListener.)\nI am pretty sure we have done all we can here -- at least I think we've tracked down every callsite where PooledClass would have helped us. I updated our recast transforms to log every syntax construct that would cause an obvious allocation and couldn't find anything. I was thinking maybe there was an array slice or a bind() in there, but experiment shows that this is not the case.", "commid": "react_issue_340", "tokennum": 509}], "negative_passages": []} | |
| {"query_id": "q-en-react-f3a060b60bc1bfaf97e0fada063de08b8ca79162b8b597f8126df0beda66ecf2", "query": "topKeyUp: eventTypes.keyUp, topMouseDown: eventTypes.mouseDown, topMouseMove: eventTypes.mouseMove, <ins> topMouseOut: eventTypes.mouseOut, topMouseOver: eventTypes.mouseOver, </ins> topMouseUp: eventTypes.mouseUp, topPaste: eventTypes.paste, topScroll: eventTypes.scroll,", "positive_passages": [{"docid": "doc-en-react-ac434d767083ac836e19c967390cf16739cdb96c2a1d7993c7c103db6b357686", "text": "(I didn't verify that we don't have more allocations than the empty-function case; I don't know of a good way to do so.)\nI might be misinformed, but isn't there quite a difference in use cases between mouseenter and mouseover events? Here's a theoretical (non-react) example working with some hover states for nested elements: I tried to apply the above concept in react (with nested components) using onMouseEnter instead, but it obviously fails because it's only triggered once on the top-most element. Moving into a child element and back has no effect. Maybe there's a better approach for this in react altogether?\nIf you render the child hierarchy with React, you can listen to on each child element you are interested in instead of using event bubbling. It is cheap.", "commid": "react_issue_340", "tokennum": 179}], "negative_passages": []} | |
| {"query_id": "q-en-react-f41796ab998cdae2715f27792da477ab83033cacb0a1fe67f9aeeff5b2a6a6da", "query": "captured: keyOf({onMouseMoveCapture: true}) } }, <ins> mouseOut: { phasedRegistrationNames: { bubbled: keyOf({onMouseOut: true}), captured: keyOf({onMouseOutCapture: true}) } }, mouseOver: { phasedRegistrationNames: { bubbled: keyOf({onMouseOver: true}), captured: keyOf({onMouseOverCapture: true}) } }, </ins> mouseUp: { phasedRegistrationNames: { bubbled: keyOf({onMouseUp: true}),", "positive_passages": [{"docid": "doc-en-react-7e215142cfee41f3a5c9f3a4523ae6786642b4cde53fcef8da4414036dde1206", "text": "Someone had the trouble in IRC about it. Edit: changed the subject from \"document it\" to \"support it\", because the documentation issue is already at .\nBetter yet, support it!\nYeah, is there a particular reason it's not supported?\nCurious if you've seen the . It's automatically injected into React by default, so you can use it today. IMHO it's (much) better than . (I suppose we could support just for the sake of completeness, but I thought I'd just make sure you guys were aware of .)\nWe discussed this for a bit on IRC -- was just confused that silently didn't work whereas other events did -- perhaps adding more documentation () will fix the problem too but it seems like we might as well add for completeness. (I agree that enter/leave are much more useful and suggested that over/out are likely missing simply because no one has needed them!)\nAgree - I believe there are a few extra allocations (not-pooled) occuring in the event system already today. I'd love to track those down before adding more mouse-move event allocations. If you open the memory profiler in Chrome and move the mouse around, you'll see memory being allocated (and then properly freed of course) but if we use es everywhere, we should be flat. That would make me much more comfortable with adding to . Edit: Just checked out - we already have which fires way more frequently than would so it's probably not such a big deal to add - though we really should get rid of all additional allocations in the event path.\nJust started to look a little bit into the allocations here. Redefining trapBubbledEvent in ReactEventEmitter with: still shows allocations in the Chrome memory timeline view, so I'm not convinced that there's anything we can do here? (Replacing trapBubbledEvent itself with a noop makes the allocations go away. simply calls addEventListener.)\nI am pretty sure we have done all we can here -- at least I think we've tracked down every callsite where PooledClass would have helped us. I updated our recast transforms to log every syntax construct that would cause an obvious allocation and couldn't find anything. I was thinking maybe there was an array slice or a bind() in there, but experiment shows that this is not the case.", "commid": "react_issue_340", "tokennum": 509}], "negative_passages": []} | |
| {"query_id": "q-en-react-f41796ab998cdae2715f27792da477ab83033cacb0a1fe67f9aeeff5b2a6a6da", "query": "captured: keyOf({onMouseMoveCapture: true}) } }, <ins> mouseOut: { phasedRegistrationNames: { bubbled: keyOf({onMouseOut: true}), captured: keyOf({onMouseOutCapture: true}) } }, mouseOver: { phasedRegistrationNames: { bubbled: keyOf({onMouseOver: true}), captured: keyOf({onMouseOverCapture: true}) } }, </ins> mouseUp: { phasedRegistrationNames: { bubbled: keyOf({onMouseUp: true}),", "positive_passages": [{"docid": "doc-en-react-ac434d767083ac836e19c967390cf16739cdb96c2a1d7993c7c103db6b357686", "text": "(I didn't verify that we don't have more allocations than the empty-function case; I don't know of a good way to do so.)\nI might be misinformed, but isn't there quite a difference in use cases between mouseenter and mouseover events? Here's a theoretical (non-react) example working with some hover states for nested elements: I tried to apply the above concept in react (with nested components) using onMouseEnter instead, but it obviously fails because it's only triggered once on the top-most element. Moving into a child element and back has no effect. Maybe there's a better approach for this in react altogether?\nIf you render the child hierarchy with React, you can listen to on each child element you are interested in instead of using event bubbling. It is cheap.", "commid": "react_issue_340", "tokennum": 179}], "negative_passages": []} | |
| {"query_id": "q-en-react-f78b432776740f2ee70b3546ccbb11f9305cb067bb74010166c736a5e647cd42", "query": "*/ var textContentAccessor = getTextContentAccessor() || 'NA'; <ins> var LEADING_SPACE = /^ /; </ins> /** * Operations used to process updates to DOM nodes. This is made injectable via * `ReactComponent.DOMIDOperations`.", "positive_passages": [{"docid": "doc-en-react-9306121422e93f6146586d22ff20af2d3e2d2860ed922937e70054809fe064b5", "text": "reported the following issue on IRC: (Both on master and 4.0) The repro case is: 1) Render 2) Render 3) Render the same as 1) The div has its innerHTML empty instead of . I don't really know what's going on. can you guys look at it?\nOne other tidbit: this only seems to happen when the value is exactly the same in step 3 as it was in step 1. If it's different (i.e. ), things work as expected.\nWhat happens if you change step 2 to a instead of a ? It works, right?\nI just reduced the test case to 19 lines.\nyeah changing 2) to use a span works as expected\nIf anyone wants to look into this, the bug is probably here\nI cannot reproduce what you are seeing: It also bugs if I use a different string\nI'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying.\nI know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a property to the React component containing the property. So, does not seem to work reproducibly, whereas seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a statement if that component gets rerendered multiple times with different inner content. Just posting this here in case other people have the same issue and stumble upon this.\nthx you saved my day :-)\nSeems like the issue is back again. Thanks, solves the problem for me too.\nIf any of you can post a simple repro case showing the broken behavior here, I'd be happy to take a look at fixing it.\nTook me a while to repro, but here you go: (ugly, but demonstrates the issue well)\nThanks. This is the same issue as . No fix currently, but using the key as a workaround is fine and I'll see if we can fix this sometime.\nThanks that was giving me fits!\nIf anyone is still seeing issues on 0.14, please make a new issue with a simple repro case.", "commid": "react_issue_377", "tokennum": 469}], "negative_passages": []} | |
| {"query_id": "q-en-react-f78b432776740f2ee70b3546ccbb11f9305cb067bb74010166c736a5e647cd42", "query": "*/ var textContentAccessor = getTextContentAccessor() || 'NA'; <ins> var LEADING_SPACE = /^ /; </ins> /** * Operations used to process updates to DOM nodes. This is made injectable via * `ReactComponent.DOMIDOperations`.", "positive_passages": [{"docid": "doc-en-react-2561d4a0be5f333acf881b6f80c1a973b0d2a5e9e6140ce5d6d62900271a0991", "text": "I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:\nReading out will rarely give you what you put in because the browser does various kinds of normalization on it. If you can repro with a standalone example though I'm happy to take a look.\nwell, that's more like a control shot :-)\nLooks like the issue still exist in 16.4.1 when using on a tag, you cannot nest other or . issue is fixed by replacing the container with a\nIf you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example. when using dangerouslySetInnerHTML on a tag, you cannot nest other or This sounds like browsers work. You can't nest into . This is why React warns when you do it (except in which case React can't validate it).", "commid": "react_issue_377", "tokennum": 312}], "negative_passages": []} | |
| {"query_id": "q-en-react-f9c985127280d043e8f647b6ba7e16154c5e4f1e6695c621018c33fa9d7738af", "query": "args.push(\"--config\" /* from stdin */); var child = spawn({ <del> cmd: \"bin/jsx-internal\", args: args </del> <ins> cmd: \"node\", args: [path.join(\"bin\", \"jsx-internal\")].concat(args) </ins> }, function(error, result, code) { if (error) { grunt.log.error(error);", "positive_passages": [{"docid": "doc-en-react-459d94b9ffcb633b04e63503fb6f939599a3860d53fc82065a5b90ffa4d8464d", "text": "H:githubreactgrunt Running \"delete-build-modules\" task Running \"jsx:normal\" (jsx) task Warning: This socket is closed. Use --force to continue. Aborted due to warnings. on windows. any hint?\nThe issue arises in the jsx task at line 42: File: [no files] Warning: This socket is closed. Use --force to continue. Error: This socket is closed. at () at doWrite () at writeOrBuffer () at () at () at (c:reactgrunttasks) at Object.<anonymous(c:reactnodemodulesgruntlibgrunt) at (c:reactnodemodulesgruntlibgrunt) at Object.<anonymous(c:reactnodemodulesgruntlibutil) at Task.runTaskFn (c:reactnode_modulesgruntlibutil) var child = spawn({ cmd: \"bin/jsx-internal\", args: args }, function(error, result, code) { if (error) { (error); done(false); } else { done(); } }); (JSON.stringify(config.getConfig())); So, looks like the spawn child's input stream is not available. Running node bin/jsx-internal\" works however, get a message saying \"Warning: still waiting for STDIN after 1000ms\"\n- can you take a look?\nI was able to work around this by changing the following in grunttasks to Obviously this change is Windows-only but does provide a possible workaround.\nWhat about changing it to\nYes, I can verify that worked on my machine. Sorry, I used some leftover code for executing batch files which requires going through cmd.\nCool, I can put up a PR for that (unless you have the time,\nSure, I can do that. Thanks for the help!", "commid": "react_issue_1292", "tokennum": 451}], "negative_passages": []} | |
| {"query_id": "q-en-react-feb85c0cff7d3032a750b51bbf462ee9361d579cc3e86e361449e7b4a34c427a", "query": "expect(console.warn.argsForCall[1][0]).toContain('WebkitTransform'); }); <ins> it('should warn about style having a trailing semicolon', function() { spyOn(console, 'warn'); CSSPropertyOperations.createMarkupForStyles({ fontFamily: 'Helvetica, arial', backgroundImage: 'url(foo;bar)', backgroundColor: 'blue;', color: 'red; ' }); expect(console.warn.callCount).toBe(2); expect(console.warn.argsForCall[0][0]).toContain('Try \"backgroundColor: blue\" instead'); expect(console.warn.argsForCall[1][0]).toContain('Try \"color: red\" instead'); }); </ins> });", "positive_passages": [{"docid": "doc-en-react-c7e982859a8cdc029effae408c11a8f287f7b31f17233bb05e0078cc7b0bb775", "text": "On the first render it works, but then the update silently fails. Expected would be the semicolon being removed, or an error/warning in the development build. Tested on Chrome latest, Firefox latest, with 0.12.1 and master. Minimal: ran into (on IRC).\nMy first instinct is to put a warning in DEV so we don't incur any costs in prod. This would be similar to our other style key warning (\"you used background-color but probably meant backgroundColor\" or whatever it is we say).\nsounds reasonable, I don't think there's any valid reason to have a semicolon there.\nIt's only a warning, but it's worth considering that is valid CSS IIRC.\nso that wouldn't warn :)\nOh right :), but I've seen plenty of invalid , but perhaps that's an exercise for some other time. Anyway, you might want to ignore white-space after the as well.\nI'm working on this issue. I've a warning, but thinking that it may be a good idea to trim any semicolons as well. The warning will serve to let developers know it's invalid syntax, but try and fix the problem while we're at it.", "commid": "react_issue_2862", "tokennum": 268}], "negative_passages": []} | |