{"query_id": "q-en-react-ab535627950c5c4f6788fdc21c9855588e086629d351666b24466bad463969c7", "query": "Nor sure what that means other than that the tests are flakey :'(\nhttps://travis-\nhttps://travis-", "positive_passages": [{"docid": "doc-en-react-8faba1735f6b2d17744137e2793573e876d08674a943e100ee050b84816a75af", "text": "function getJSReport(browser){ return browser .waitForCondition(\"typeof window.jasmine != 'undefined'\", 5e3) .waitFor(wd.asserters.jsCondition(\"typeof window.jasmine != 'undefined'\"), 5e3, 50) .fail(function(error){ throw Error(\"The test page didn't load properly. \" + error); }) .waitForCondition(\"typeof window.jasmine.getJSReport != 'undefined'\", 10e3) .waitForCondition(\"window.postDataToURL.running <= 0\", 30e3) .waitFor(wd.asserters.jsCondition(\"typeof window.jasmine.getJSReport != 'undefined'\"), 60e3, 100) .waitFor(wd.asserters.jsCondition(\"window.postDataToURL.running <= 0\"), 30e3, 500) .eval(\"jasmine.getJSReport().passed\"); }", "commid": "react_pr_635"}], "negative_passages": []}
{"query_id": "q-en-react-ab535627950c5c4f6788fdc21c9855588e086629d351666b24466bad463969c7", "query": "Nor sure what that means other than that the tests are flakey :'(\nhttps://travis-\nhttps://travis-", "positive_passages": [{"docid": "doc-en-react-4734459bb16532eb5aafa8f3bbb5dd04693fbfbd22abcd7e1fb13c89b20cc667", "text": "urls.unshift('../node_modules/es5-shim/es5-shim.js'); } var cacheBust = '?_=' + Date.now().toString(36); var cacheBust = '?_=' + (+new Date).toString(36); for (var urls_index = -1, urls_length = urls.length; ++urls_index < urls_length;) { document.write('');", "commid": "react_pr_635"}], "negative_passages": []}
{"query_id": "q-en-react-53bf20fc49b7919c57503cee6ac4dd93f525eb831331357f4f8c4664531d7a75", "query": "Passing a function with some properties (simply the wrong thing) into yields rather cryptic: especially since the message says it is not the caller's fault.\nOne could add an invariant to But it is strange that the invariants in and don't mention arrays and objects, respectively.\nis also a very contextual name (I have no idea what the author meant). I agree that these messages could be better.", "positive_passages": [{"docid": "doc-en-react-3007f0673be52064524a00db56e1c9591a291cecd9b1d55e789410281772ed12", "text": "* @protected */ setState: function(partialState, callback) { invariant( typeof partialState === 'object' || partialState == null, 'setState(...): takes an object of state variables to update.' ); if (__DEV__){ if (partialState == null) { console.warn( 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().' ); } } // Merge with `_pendingState` if it exists, otherwise with existing state. this.replaceState( merge(this._pendingState || this.state, partialState),", "commid": "react_pr_822"}], "negative_passages": []}
{"query_id": "q-en-react-53bf20fc49b7919c57503cee6ac4dd93f525eb831331357f4f8c4664531d7a75", "query": "Passing a function with some properties (simply the wrong thing) into yields rather cryptic: especially since the message says it is not the caller's fault.\nOne could add an invariant to But it is strange that the invariants in and don't mention arrays and objects, respectively.\nis also a very contextual name (I have no idea what the author meant). I agree that these messages could be better.", "positive_passages": [{"docid": "doc-en-react-bf5798b90c09f75d39944d2b957e97fc266706845ce1d800e084eabfffafd0d5", "text": "checkMergeArrayArgs: function(one, two) { invariant( Array.isArray(one) && Array.isArray(two), 'Critical assumptions about the merge functions have been violated. ' + 'This is the fault of the merge functions themselves, not necessarily ' + 'the callers.' 'Tried to merge arrays, instead got %s and %s.', one, two ); },", "commid": "react_pr_822"}], "negative_passages": []}
{"query_id": "q-en-react-53bf20fc49b7919c57503cee6ac4dd93f525eb831331357f4f8c4664531d7a75", "query": "Passing a function with some properties (simply the wrong thing) into yields rather cryptic: especially since the message says it is not the caller's fault.\nOne could add an invariant to But it is strange that the invariants in and don't mention arrays and objects, respectively.\nis also a very contextual name (I have no idea what the author meant). I agree that these messages could be better.", "positive_passages": [{"docid": "doc-en-react-27ce1f5c9dc1f4b83ec14da9bdb62fb7c8e671e4406e25c42cdaee2a7bc06ea0", "text": "checkMergeObjectArg: function(arg) { invariant( !isTerminal(arg) && !Array.isArray(arg), 'Critical assumptions about the merge functions have been violated. ' + 'This is the fault of the merge functions themselves, not necessarily ' + 'the callers.' 'Tried to merge an object, instead got %s.', arg ); },", "commid": "react_pr_822"}], "negative_passages": []}
{"query_id": "q-en-react-5360ec7ebda3ce89021bda97c98ba633343da1ad01a2cb94b0daeb001278e958", "query": "Firs, it's unitless. I've seen a hack where the value is being specified as to make it pass the check and skip our adding of 'px'. Further, is actually a shorthand property, so we should support the expansion into the right properties.\nI don't think we need to do anything special for shorthand properties except for the list needed only for IE8.\nrelated: there are also some obscure css properties that can be unitless: Edit: + widow, - counter-*\nWhile we're at it, is also unitless. The properties mentioned in the above link don't actually take a single number.\nI'm not saying it's a great idea, just putting it out there... but what if we switched over to , , , , , etc. Not the prettiest, but perhaps prettier than and you can now access unmodified traditional CSS behavior and if you want to use the short-hand style, it's obvious and unambiguous, and not limited to just . It doesn't modify expected behavior, it doesn't conflict... philosophically that's up to you. :) ...speaking with people in the chat, I agree that it's a bad idea... however, seeing other peoples gripes with how React doesn't vendor-prefix, etc, etc. Perhaps the real solution is for React to export a settable where we can supply our own behavior and leave all of this outside of React itself, if you want to auto-suffix , use the addon. And this is a bad idea as well as it would prevent reliably sharing components. is currently ambiguous as it supports unitless and and thus we cannot auto-suffix it...\nline-height 'px' is used 15x-50x more times than unitless, em or percentage on fb codebase. I feel like this should be the default and we should provide a more verbose way to use it in an unitless way.\nI agree, my only issue with that is that we would explicitly break with the CSS standard then.\nMy view on this is that the CSS standard is only using strings. So if you say '1.5', React is just going to output '1.5'. Now if you say 23 (the number), then React is going to be able to add any convenience it wants, such as adding 'px' as it's the most common use case.\nIt doesn't conflict today (probably never will but still). Also, do we now want to add , , (and so on for each numeric unit)? I think I'm more likely to go for forcing a unit if you want one. (eg, doesn't get converted to , you have to put the in yourself).\nMy idea with having the units as a suffix of the name is that it could be a universal test for all properties (for simplicity). If , or whatever is at the end the property name, we remove it and add it to the value instead. That way the only thing we would need to hard-code is which units are allowed, so the implementation would be minimal and barring any new units, future proof. While it theoretically could conflict, I don't see how it ever could, the units have very non-wordy names (case would obviously be taken into account as it already is). However, a practical issue is what to do if there are multiple units specified for the same property. So I definitely see that this may not be the favored way to go, just putting it out there :) I like idea, but I feel like it would be hair thin separation of the two and possibly \"dangerous\"... but it is neat, and likely what the user intended.\nFixed by -- we can discuss units more on a separate issue if needed.", "positive_passages": [{"docid": "doc-en-react-cec87f280fa9de2093b22995f60bc68c6f34138f838f6de2034bd3beca51ce39", "text": "* CSS properties which accept numbers but are not in units of \"px\". */ var isUnitlessNumber = { columnCount: true, fillOpacity: true, flex: true, flexGrow: true, flexShrink: true, fontWeight: true, lineHeight: true, opacity: true, order: true, orphans: true, pitchRange: true, richness: true, stress: true, volume: true, widows: true, zIndex: true, zoom: true };", "commid": "react_pr_861"}], "negative_passages": []}
{"query_id": "q-en-react-5360ec7ebda3ce89021bda97c98ba633343da1ad01a2cb94b0daeb001278e958", "query": "Firs, it's unitless. I've seen a hack where the value is being specified as to make it pass the check and skip our adding of 'px'. Further, is actually a shorthand property, so we should support the expansion into the right properties.\nI don't think we need to do anything special for shorthand properties except for the list needed only for IE8.\nrelated: there are also some obscure css properties that can be unitless: Edit: + widow, - counter-*\nWhile we're at it, is also unitless. The properties mentioned in the above link don't actually take a single number.\nI'm not saying it's a great idea, just putting it out there... but what if we switched over to , , , , , etc. Not the prettiest, but perhaps prettier than and you can now access unmodified traditional CSS behavior and if you want to use the short-hand style, it's obvious and unambiguous, and not limited to just . It doesn't modify expected behavior, it doesn't conflict... philosophically that's up to you. :) ...speaking with people in the chat, I agree that it's a bad idea... however, seeing other peoples gripes with how React doesn't vendor-prefix, etc, etc. Perhaps the real solution is for React to export a settable where we can supply our own behavior and leave all of this outside of React itself, if you want to auto-suffix , use the addon. And this is a bad idea as well as it would prevent reliably sharing components. is currently ambiguous as it supports unitless and and thus we cannot auto-suffix it...\nline-height 'px' is used 15x-50x more times than unitless, em or percentage on fb codebase. I feel like this should be the default and we should provide a more verbose way to use it in an unitless way.\nI agree, my only issue with that is that we would explicitly break with the CSS standard then.\nMy view on this is that the CSS standard is only using strings. So if you say '1.5', React is just going to output '1.5'. Now if you say 23 (the number), then React is going to be able to add any convenience it wants, such as adding 'px' as it's the most common use case.\nIt doesn't conflict today (probably never will but still). Also, do we now want to add , , (and so on for each numeric unit)? I think I'm more likely to go for forcing a unit if you want one. (eg, doesn't get converted to , you have to put the in yourself).\nMy idea with having the units as a suffix of the name is that it could be a universal test for all properties (for simplicity). If , or whatever is at the end the property name, we remove it and add it to the value instead. That way the only thing we would need to hard-code is which units are allowed, so the implementation would be minimal and barring any new units, future proof. While it theoretically could conflict, I don't see how it ever could, the units have very non-wordy names (case would obviously be taken into account as it already is). However, a practical issue is what to do if there are multiple units specified for the same property. So I definitely see that this may not be the favored way to go, just putting it out there :) I like idea, but I feel like it would be hair thin separation of the two and possibly \"dangerous\"... but it is neat, and likely what the user intended.\nFixed by -- we can discuss units more on a separate issue if needed.", "positive_passages": [{"docid": "doc-en-react-50d5598a1ecf06b53398ae235a982412740b4603ea301eacccd3469d4802bd3d", "text": "}); it('should not append `px` to styles that might need a number', function() { expect(CSSPropertyOperations.createMarkupForStyles({ fillOpacity: 1, fontWeight: 2, opacity: 3, orphans: 4, zIndex: 5, zoom: 6, lineHeight: 7 })).toBe( 'fill-opacity:1;font-weight:2;opacity:3;orphans:4;z-index:5;zoom:6;' + 'line-height:7;' ); var unitlessProperties = [ 'columnCount', 'fillOpacity', 'flex', 'flexGrow', 'flexShrink', 'fontWeight', 'lineHeight', 'opacity', 'order', 'orphans', 'pitchRange', 'richness', 'stress', 'volume', 'widows', 'zIndex', 'zoom' ]; unitlessProperties.forEach(function(property) { var styles = {}; styles[property] = 1; expect(CSSPropertyOperations.createMarkupForStyles(styles)) .toMatch(/:1;$/); }); }); it('should set style attribute when styles exist', function() {", "commid": "react_pr_861"}], "negative_passages": []}
{"query_id": "q-en-react-3d826d584ae12d0c851bfe45a8a182c34466d0f4c7bfb597962db7b869770dda", "query": "When I run jsx --watch src/ build/ it compiles the jsx files and create a file in the build directory. On the next jsx file modification, the jsx process crashes. Once the is present, jsx won't compile jsx files even when ran manually. I use OSX Maverick and jsx 0.8.13.\nAFAIK this is a \"bug\" with or whatever JSX relies on to expose that feature. Just make sure to close the watch instance instead of just closing the terminal/powering down and it should be fine.\nDoes it work again if you remove the file?\nYes it does. Oh or wait, the crashing.\nIt seems like there are two ways of fixing this. We can either out why is not cleaning up the file when the process exits, or the functionality and just hope people don't accidentally have multiple processes targeting the same output directory. I'm pretty comfortable with option 2, honestly. Thoughts,\nYeah, no lock seems fine for me, it could warn if it was found perhaps? Another thing to mention that has been happening to me, I'm using React through a Linux VM and accessing the filesystem through samba. When saving a file it immediately triggers a recompile before the file has finished saving, causing it to error. Shortly after it recompiles it again, so no harm, but it's worth noting.\nI'm fine with no locking. I didn't even know that existed. Do what works!", "positive_passages": [{"docid": "doc-en-react-67f9022d491ffeba0e3f72f5cd6879bf0df3b76370ab9dbcfaf7a50cc425e302", "text": "\"url\": \"https://github.com/facebook/react\" }, \"dependencies\": { \"commoner\": \"~0.8.14\", \"commoner\": \"~0.9.0\", \"esprima-fb\": \"~2001.1001.0-dev-harmony-fb\", \"jstransform\": \"~2.0.2\" },", "commid": "react_pr_981"}], "negative_passages": []}
{"query_id": "q-en-react-2e85d1c388630c3452189c0522bfd16aa31ba5acfb33e1603d41a69c902342c4", "query": "After upgrading from React 0.10 to 0.11 our handler fires during server-side rendering and ends up in which requires access to the DOM, i.e. : Redacted stack trace:\nI have the same problem\nI'm having the same problem. I was so happy to see you finally the hrefLang attribute support and tried to upgrade immediately. Unfortunately this problem is keeping me from upgrading.\nFYI, we worked around it by using which might work in your case too depending on your use case.\nWow this sounds like a big regression. Can you construct a simple repro case?\nI will try but I probably won\u2019t be able to until Sunday the earliest. Frankly, the error doesn\u2019t happen with for every handler we have, so there might be something we\u2019re doing wrong.\nThis might happen always if you setState within a componentWillMount? Agree that we need to fix this.\nFor me it happens when I do setState in componentWillMount. Will try to come up with the simplest repro case.\nOh, setState() is probably going through ReactUpdates which is using the (browser-specific as of 0.11) ReactReconcileTransaction I think.\nYes, we are using in the failing handler. Is that a bad practice?\nmaybe? why are you doing that vs ?\nHere\u2019s the part of the stack trace ( is the offending handler):\nThis is the most simple example that reproduces the problem:\nTrying to figure out if the right move is to fix in or instead forbid in in favor of . Thoughts\nThe former; we've always said this is supported.\nbut why do we support it? seems like \"more than one way to do it\"...\nOne use case is computing something based on props in both componentWillMount and componentWillReceiveProps; you can make a helper and call it in both places.\ndoes the same thing, no?\nBased on your example, I can see now that calling is not very elegant in but disallowing it but would be a breaking change based on the current documentation: I\u2019m ok with a breaking change in releases as long as it\u2019s documented \u00e0 la change.\nWe're going to put out 0.11.1 with this (and a couple other ride-alongs). Thanks for bringing it to our attention!\n:+1: Thanks :smile:\nHi guys! The issue referenced above looks (reactjs/react-rails) related to this one... input welcome!", "positive_passages": [{"docid": "doc-en-react-86fa3b086bf47779ea8ba228dbf7f456a53f187ff313c418f4b2489d7df5dac8", "text": "var mocks = require('mocks'); var ExecutionEnvironment; var React; var ReactMarkupChecksum; var ReactMount; var ReactReconcileTransaction; var ReactTestUtils; var ReactServerRendering; var ReactMarkupChecksum; var ExecutionEnvironment; var ID_ATTRIBUTE_NAME;", "commid": "react_pr_1870"}], "negative_passages": []}
{"query_id": "q-en-react-2e85d1c388630c3452189c0522bfd16aa31ba5acfb33e1603d41a69c902342c4", "query": "After upgrading from React 0.10 to 0.11 our handler fires during server-side rendering and ends up in which requires access to the DOM, i.e. : Redacted stack trace:\nI have the same problem\nI'm having the same problem. I was so happy to see you finally the hrefLang attribute support and tried to upgrade immediately. Unfortunately this problem is keeping me from upgrading.\nFYI, we worked around it by using which might work in your case too depending on your use case.\nWow this sounds like a big regression. Can you construct a simple repro case?\nI will try but I probably won\u2019t be able to until Sunday the earliest. Frankly, the error doesn\u2019t happen with for every handler we have, so there might be something we\u2019re doing wrong.\nThis might happen always if you setState within a componentWillMount? Agree that we need to fix this.\nFor me it happens when I do setState in componentWillMount. Will try to come up with the simplest repro case.\nOh, setState() is probably going through ReactUpdates which is using the (browser-specific as of 0.11) ReactReconcileTransaction I think.\nYes, we are using in the failing handler. Is that a bad practice?\nmaybe? why are you doing that vs ?\nHere\u2019s the part of the stack trace ( is the offending handler):\nThis is the most simple example that reproduces the problem:\nTrying to figure out if the right move is to fix in or instead forbid in in favor of . Thoughts\nThe former; we've always said this is supported.\nbut why do we support it? seems like \"more than one way to do it\"...\nOne use case is computing something based on props in both componentWillMount and componentWillReceiveProps; you can make a helper and call it in both places.\ndoes the same thing, no?\nBased on your example, I can see now that calling is not very elegant in but disallowing it but would be a breaking change based on the current documentation: I\u2019m ok with a breaking change in releases as long as it\u2019s documented \u00e0 la change.\nWe're going to put out 0.11.1 with this (and a couple other ride-alongs). Thanks for bringing it to our attention!\n:+1: Thanks :smile:\nHi guys! The issue referenced above looks (reactjs/react-rails) related to this one... input welcome!", "positive_passages": [{"docid": "doc-en-react-8c6664b9dd18238c386e8388cca596d050fb9e678aa76b4b382edadcadedbbca", "text": "beforeEach(function() { require('mock-modules').dumpCache(); React = require('React'); ReactMarkupChecksum = require('ReactMarkupChecksum'); ReactMount = require('ReactMount'); ReactTestUtils = require('ReactTestUtils'); ReactReconcileTransaction = require('ReactReconcileTransaction'); ExecutionEnvironment = require('ExecutionEnvironment'); ExecutionEnvironment.canUseDOM = false; ReactServerRendering = require('ReactServerRendering'); ReactMarkupChecksum = require('ReactMarkupChecksum'); var DOMProperty = require('DOMProperty'); ID_ATTRIBUTE_NAME = DOMProperty.ID_ATTRIBUTE_NAME;", "commid": "react_pr_1870"}], "negative_passages": []}
{"query_id": "q-en-react-2e85d1c388630c3452189c0522bfd16aa31ba5acfb33e1603d41a69c902342c4", "query": "After upgrading from React 0.10 to 0.11 our handler fires during server-side rendering and ends up in which requires access to the DOM, i.e. : Redacted stack trace:\nI have the same problem\nI'm having the same problem. I was so happy to see you finally the hrefLang attribute support and tried to upgrade immediately. Unfortunately this problem is keeping me from upgrading.\nFYI, we worked around it by using which might work in your case too depending on your use case.\nWow this sounds like a big regression. Can you construct a simple repro case?\nI will try but I probably won\u2019t be able to until Sunday the earliest. Frankly, the error doesn\u2019t happen with for every handler we have, so there might be something we\u2019re doing wrong.\nThis might happen always if you setState within a componentWillMount? Agree that we need to fix this.\nFor me it happens when I do setState in componentWillMount. Will try to come up with the simplest repro case.\nOh, setState() is probably going through ReactUpdates which is using the (browser-specific as of 0.11) ReactReconcileTransaction I think.\nYes, we are using in the failing handler. Is that a bad practice?\nmaybe? why are you doing that vs ?\nHere\u2019s the part of the stack trace ( is the offending handler):\nThis is the most simple example that reproduces the problem:\nTrying to figure out if the right move is to fix in or instead forbid in in favor of . Thoughts\nThe former; we've always said this is supported.\nbut why do we support it? seems like \"more than one way to do it\"...\nOne use case is computing something based on props in both componentWillMount and componentWillReceiveProps; you can make a helper and call it in both places.\ndoes the same thing, no?\nBased on your example, I can see now that calling is not very elegant in but disallowing it but would be a breaking change based on the current documentation: I\u2019m ok with a breaking change in releases as long as it\u2019s documented \u00e0 la change.\nWe're going to put out 0.11.1 with this (and a couple other ride-alongs). Thanks for bringing it to our attention!\n:+1: Thanks :smile:\nHi guys! The issue referenced above looks (reactjs/react-rails) related to this one... input welcome!", "positive_passages": [{"docid": "doc-en-react-e4c9f26c4e027620bdc25234dd0ae617a2ff1a3f0a3e30f84a9348766a1ebba4", "text": "'a valid ReactComponent.' ); }); it('allows setState in componentWillMount without using DOM', function() { var Component = React.createClass({ componentWillMount: function() { this.setState({text: 'hello, world'}); }, render: function() { return * **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. * **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. ", "commid": "react_pr_2635"}], "negative_passages": []}
{"query_id": "q-en-react-d933a6e06b1d6c49d61d5e7b815e1e0cc110275a21e1ed9185bb07dc14989eab", "query": "Understandably general given that this is used to merge a couple things, but the actual use case is when or (or but shh) is used in a mixin and the component and both return an object with the same key. We should make this error mention something about those methods so people have an idea of where to look instead of them coming to IRC and being (rightfully) confused.", "positive_passages": [{"docid": "doc-en-react-e4f795e1235ca92806e674ac5b38f4fc9f8c66b295cbefb2ad5b77e4d6552175", "text": "invariant( one[key] === undefined, 'mergeObjectsWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: %s', 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key ); one[key] = value;", "commid": "react_pr_2037"}], "negative_passages": []}
{"query_id": "q-en-react-d933a6e06b1d6c49d61d5e7b815e1e0cc110275a21e1ed9185bb07dc14989eab", "query": "Understandably general given that this is used to merge a couple things, but the actual use case is when or (or but shh) is used in a mixin and the component and both return an object with the same key. We should make this error mention something about those methods so people have an idea of where to look instead of them coming to IRC and being (rightfully) confused.", "positive_passages": [{"docid": "doc-en-react-4134d81734458406d3b456b46dcc61bd82b5668ca375b3bf775b2c2bb168855a", "text": "instance = ReactTestUtils.renderIntoDocument(instance); }).toThrow( 'Invariant Violation: mergeObjectsWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: x' 'Tried to merge two objects with the same key: `x`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.' ); });", "commid": "react_pr_2037"}], "negative_passages": []}
{"query_id": "q-en-react-5b07e7e228a24761e0570be670d9936d76e2b49a3d985ee42dfc361ae0dea954", "query": "Without , is , which causes this line in to throw. Fix is to make shallowEqual bail if either argument is falsey (or not an object if we want to be very safe).\nIs this with PureRenderMixin?\nYes, I meant to link to the jsbin: ,js,console,output I'm putting together a PR now.\nIt is potentially worth noting that getInitialState is likely to become required for stateful components in the near future. See It is already the case that any component calling should ideally be specifying a .\nI definitely think it makes sense to make required for stateful components +1", "positive_passages": [{"docid": "doc-en-react-d664c9c45770d6e9f28a6f5e6e8e0d6090c2c2e680103ebecfb53a558305bce9", "text": " /** * Copyright 2014-2015, 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'; require('mock-modules') .dontMock('shallowEqual'); var shallowEqual; describe('shallowEqual', function() { beforeEach(function() { shallowEqual = require('shallowEqual'); }); it('returns false if either argument is null', function() { expect(shallowEqual(null, {})).toBe(false); expect(shallowEqual({}, null)).toBe(false); }); it('returns true if both arguments are null or undefined', function() { expect(shallowEqual(null, null)).toBe(true); expect(shallowEqual(undefined, undefined)).toBe(true); }); it('returns true if arguments are shallow equal', function() { expect( shallowEqual( {a: 1, b: 2, c: 3}, {a: 1, b: 2, c: 3} ) ).toBe(true); }); it('returns false if first argument has too many keys', function() { expect( shallowEqual( {a: 1, b: 2, c: 3}, {a: 1, b: 2} ) ).toBe(false); }); it('returns false if second argument has too many keys', function() { expect( shallowEqual( {a: 1, b: 2}, {a: 1, b: 2, c: 3} ) ).toBe(false); }); it('returns false if arguments are not shallow equal', function() { expect( shallowEqual( {a: 1, b: 2, c: {}}, {a: 1, b: 2, c: {}} ) ).toBe(false); }); }); ", "commid": "react_pr_3317"}], "negative_passages": []}
{"query_id": "q-en-react-5b07e7e228a24761e0570be670d9936d76e2b49a3d985ee42dfc361ae0dea954", "query": "Without , is , which causes this line in to throw. Fix is to make shallowEqual bail if either argument is falsey (or not an object if we want to be very safe).\nIs this with PureRenderMixin?\nYes, I meant to link to the jsbin: ,js,console,output I'm putting together a PR now.\nIt is potentially worth noting that getInitialState is likely to become required for stateful components in the near future. See It is already the case that any component calling should ideally be specifying a .\nI definitely think it makes sense to make required for stateful components +1", "positive_passages": [{"docid": "doc-en-react-8f0f6eb1846a5dbcf8f6f26b72dbb7162700a5dbaaede96d44f06a563947b22e", "text": "if (objA === objB) { return true; } if (!objA || !objB) { return false; } var key; // Test for A's keys different from B. for (key in objA) {", "commid": "react_pr_3317"}], "negative_passages": []}
{"query_id": "q-en-react-992788d04eacfdbd9f7506fb810dc3b3a874dac91bdb786726dd5919742f52ba", "query": "! 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.", "positive_passages": [{"docid": "doc-en-react-89f6ad41bb608aa76e5bfa8a414adf2c3657357b5cf38c787f2ac010ca54b5d1", "text": "