{"query": "title: Animation - id: two-way-binding-helpers title: Two-Way Binding Helpers - id: class-name-manipulation title: Class Name Manipulation - id: test-utils title: Test Utilities - id: clone-with-props", "pos": ["Now that we deprecated it, we should remove it before we ship 0.14. Would you like the honors"], "neg": []} {"query": "topError: eventTypes.error, topFocus: eventTypes.focus, topInput: eventTypes.input, topInvalid: eventTypes.invalid, topKeyDown: eventTypes.keyDown, topKeyPress: eventTypes.keyPress, topKeyUp: eventTypes.keyUp,", "pos": ["Ref:\nI'm taking a look at this as a first bug - from the docs and some testing, the event seems to be fired at the form element level rather than the form itself. That is to say: will not log on submit, but: will log on submit. Does this match the expected behaviour, and if so do we want the handler to be on the individual React.DOM form elements (i.e. so it is called when that element is invalid), or do we want it to bubble up to the parent (i.e. so it is called whenever at least one element in that form is invalid)?\nWe should match the DOM and fire it on the element (not the form). We already have support for these events which don't bubble. Most of our events are at the document level and then delegated but the ones which don't bubble need to be to specific elements on creation. Here's how we're doing it for forms and the submit & reset events: Thanks for taking this on! Feel free to get a PR up before it's completely ready if you have questions / need help.\nThanks Paul, good to know I was looking in the right place! Will update when I have had time to create a PR or if I need any help :) Cheers Tom\nHey, I've put together a PR at - it would be great to get your feedback on it. A couple of specific questions I had: should I handle automated testing of this? There's a lot of test code to look at and I'm unfamiliar with the React codebase, so I'm unsure if/how this should be tested. the splitting out of the logic make sense? Or do you think it would be better to have a separate statement for this bit, preceeding the other in , matching all the elements which need this setup, and then keep the other as is (minus the first ) Any feedback appreciated, this does seem to work but I'm totally new to the React code so not sure if the way I've gone about it is suitable or not! Cheers, Tom\nAwesome!"], "neg": []} {"query": " ## 4.4.0 * No changes, this was an automated release together with React 18. ## 4.3.0 * Support ESLint 8. ([@MichaelDeBoey](https://github.com/MichaelDeBoey) in [#22248](https://github.com/facebook/react/pull/22248))", "pos": ["Currently the CHANGELOG shows 4.3.0 as the latest version of , but at least on , there is not a 4.4.0. React version: n/a Changelog to version on Link to code example: n/a No 4.4.0 explanation in 0 explanation in\nI think 4.4.0 was essentially a no-op release to correspond with React 18 release (though cc to confirm). Looking at what's changed in the package between the 4.3.0 release and Monday's 4.4.0 \"release\" I see: I believe this is the same thing as happened with the ESLint 4.2.0 release and React 17. I believe the \"fix\" here would be to just add a 4.4.0 release to the CHANGELOG that notes this.\nThanks so much That definitely seems like the right fix!"], "neg": []} {"query": "2. If you've added code that should be tested, add tests! 3. If you've changed APIs, update the documentation. 4. Ensure the test suite passes (`npm test`). 5. Make sure your code lints (`npm run lint`). 6. Format your code with [prettier](https://github.com/prettier/prettier) (`npm run prettier`). 5. Format your code with [prettier](https://github.com/prettier/prettier) (`npm run prettier`). 6. Make sure your code lints (`npm run lint`). 7. Run the [Flow](https://flowtype.org/) typechecks (`npm run flow`). 8. If you added or removed any tests, run `./scripts/fiber/record-tests` before submitting the pull request, and commit the resulting changes. 9. If you haven't already, complete the CLA.", "pos": ["Do you want to request a feature or report a bug? This is more of a documentation discussion What is the current behavior? Currently, the contributing guide lists the lint step before running prettier. For example, says: 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: ). What is the expected behavior? I think it would make more sense to run prettier first, since it can automatically get rid of certain lint errors (like single-quotes or comma-dangle). A first-time contributor following the steps in order might waste time fixing things manually at the lint step before proceeding to the formatting step. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? N/A\nHappy to take PR fixing it.\nThanks to reminding, I make a PR for it.\nSeems like this was fixed."], "neg": []} {"query": "$RefreshReg$(_c2, \"Bar\"); `; exports[`ReactFreshBabelPlugin uses custom identifiers for $RefreshReg$ and $RefreshSig$ 1`] = ` var _s = import.meta.refreshSig(); export default function Bar() { _s(); useContext(X); return ; } _s(Bar, \"useContext{}\"); _c = Bar; ; var _c; import.meta.refreshReg(_c, \"Bar\"); `; exports[`ReactFreshBabelPlugin uses original function declaration if it get reassigned 1`] = ` function Hello() { return

Hi

;", "pos": ["Do you want to request a feature or report a bug? Feature Right now babel plugin emits globals: It would be nice to have them configurable. That would allow to use in environments like SystemJS and have simpler implementation: If you don't mind I could create PR with changes to react-refresh/babel next week. environment:\nHappy to take a PR."], "neg": []} {"query": "// eslint-disable-next-line no-fallthrough case 'mouseenter': case 'mouseleave': case 'pointerenter': case 'pointerleave': return ContinuousEventPriority; case 'message': { // We might be in the Scheduler callback.", "pos": ["Currently the simple event plugin defines a priority for the event but not all events go through the SimpleEventPlugin. That's just one of several EventPlugins. The remaining ones now get the wrong priority associated with them. E.g. I think all of these should be discrete: change compositionend compositionstart compositionupdate selectionchange textinput These show up too but I don't know if they're even bridged. dblclick pointerenter pointerleave Flare defines its own priorities."], "neg": []} {"query": "captured: keyOf({onInputCapture: true}), }, }, invalid: { phasedRegistrationNames: { bubbled: keyOf({onInvalid: true}), captured: keyOf({onInvalidCapture: true}), }, }, keyDown: { phasedRegistrationNames: { bubbled: keyOf({onKeyDown: true}),", "pos": ["Ref:\nI'm taking a look at this as a first bug - from the docs and some testing, the event seems to be fired at the form element level rather than the form itself. That is to say: will not log on submit, but: will log on submit. Does this match the expected behaviour, and if so do we want the handler to be on the individual React.DOM form elements (i.e. so it is called when that element is invalid), or do we want it to bubble up to the parent (i.e. so it is called whenever at least one element in that form is invalid)?\nWe should match the DOM and fire it on the element (not the form). We already have support for these events which don't bubble. Most of our events are at the document level and then delegated but the ones which don't bubble need to be to specific elements on creation. Here's how we're doing it for forms and the submit & reset events: Thanks for taking this on! Feel free to get a PR up before it's completely ready if you have questions / need help.\nThanks Paul, good to know I was looking in the right place! Will update when I have had time to create a PR or if I need any help :) Cheers Tom\nHey, I've put together a PR at - it would be great to get your feedback on it. A couple of specific questions I had: should I handle automated testing of this? There's a lot of test code to look at and I'm unfamiliar with the React codebase, so I'm unsure if/how this should be tested. the splitting out of the logic make sense? Or do you think it would be better to have a separate statement for this bit, preceeding the other in , matching all the elements which need this setup, and then keep the other as is (minus the first ) Any feedback appreciated, this does seem to work but I'm totally new to the React code so not sure if the way I've gone about it is suitable or not! Cheers, Tom\nAwesome!"], "neg": []} {"query": " /** * Copyright 2013-2014 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the \"License\"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an \"AS IS\" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @jsx React.DOM * @emails react-core */ \"use strict\"; var React; var ReactDescriptor; describe('ReactDescriptor', function() { beforeEach(function() { React = require('React'); ReactDescriptor = require('ReactDescriptor'); }); it('should identify valid descriptors correctly', function() { var Component = React.createClass({ render: function() { return
; } }); expect(ReactDescriptor.isValidDescriptor(
)).toEqual(true); expect(ReactDescriptor.isValidDescriptor()).toEqual(true); expect(ReactDescriptor.isValidDescriptor(null)).toEqual(false); expect(ReactDescriptor.isValidDescriptor(true)).toEqual(false); expect(ReactDescriptor.isValidDescriptor({})).toEqual(false); expect(ReactDescriptor.isValidDescriptor(\"string\")).toEqual(false); expect(ReactDescriptor.isValidDescriptor(React.DOM.div)).toEqual(false); expect(ReactDescriptor.isValidDescriptor(Component)).toEqual(false); }); }); ", "pos": ["The last two assertions in this new test don't pass because of the duck-typing check in . Not quite sure what you had in mind here. Not every object whose is a component class is a valid descriptor\u2026 right?\nThis is an intermediate step. Currently the duck typing is flawed regardless. Descriptors will probably get an inheritance chain so that instanceof ReactDescriptor works as a safer check. Only descriptors should pass. We could probably check for props too. It is expected that component classes themselves fail the test. Therefore it should also be renamed. On Feb 24, 2014, at 7:42 AM, Ben Alpert wrote:\nRight -- with the current code, returns true when passed a component class, which is wrong.\nThat's right. We should add that unit test. Out of curiosity, how did you find this? On Feb 24, 2014, at 1:51 PM, Ben Alpert wrote:\nI was adding a warning for passing a component class to renderComponent because of this Stack Overflow question:\nI think this is fixed. Not sure if we have a solid unit test to cover this."], "neg": []} {"query": "const {type} = this._element; if (typeof type.getDerivedStateFromProps === 'function') { if (__DEV__) { const instance = this._instance; // If getDerivedStateFromProps() is defined, \"unsafe\" lifecycles won't be called. // Warn about these lifecycles if they are present. // Don't warn about react-lifecycles-compat polyfilled methods though. let foundWillMountName = null; let foundWillReceivePropsName = null; let foundWillUpdateName = null; if ( typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true ) { foundWillMountName = 'componentWillMount'; } else if (typeof instance.UNSAFE_componentWillMount === 'function') { foundWillMountName = 'UNSAFE_componentWillMount'; } if ( typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true ) { foundWillReceivePropsName = 'componentWillReceiveProps'; } else if ( typeof instance.UNSAFE_componentWillReceiveProps === 'function' ) { foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; } if (typeof instance.componentWillUpdate === 'function') { foundWillUpdateName = 'componentWillUpdate'; } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') { foundWillUpdateName = 'UNSAFE_componentWillUpdate'; } if ( foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null ) { const componentName = getName(type, instance) || 'Component'; if (!didWarnAboutLegacyLifecyclesAndDerivedState[componentName]) { warning( false, 'Unsafe legacy lifecycles will not be called for components using ' + 'the new getDerivedStateFromProps() API.nn' + '%s uses getDerivedStateFromProps() but also contains the following legacy lifecycles:' + '%s%s%snn' + 'The above lifecycles should be removed. Learn more about this warning here:n' + 'https://fb.me/react-async-component-lifecycle-hooks', componentName, foundWillMountName !== null ? `n ${foundWillMountName}` : '', foundWillReceivePropsName !== null ? `n ${foundWillReceivePropsName}` : '', foundWillUpdateName !== null ? `n ${foundWillUpdateName}` : '', ); didWarnAboutLegacyLifecyclesAndDerivedState[componentName] = true; } } } const partialState = type.getDerivedStateFromProps.call( null, props, this._instance.state, ); if (__DEV__) { if (partialState === undefined) { const componentName = getName(type, this._instance); if (!didWarnAboutUndefinedDerivedState[componentName]) { warning( false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName, ); didWarnAboutUndefinedDerivedState[componentName] = componentName; } } } if (partialState != null) { const oldState = this._newState || this._instance.state; const newState = Object.assign({}, oldState, partialState);", "pos": ["For consideration. These warnings are already covered by renderers based on react-reconciler. Maybe we don't gain that much by mirroring them in the shallow renderer? Maybe it's not worth the complexity? Particularly with more complicated warnings like the ones being for and ."], "neg": []} {"query": "if (!isAnimationFrameScheduled) { // Schedule another animation callback so we retry later. isAnimationFrameScheduled = true; requestAnimationFrameForReact(animationTick); localRequestAnimationFrame(animationTick); } } };", "pos": [" ## 4.11.1 (April 11, 2021) #### Bugfix * Fixed broken import in `react-devtools-inline` for feature flags file ([bvaughn](https://github.com/bvaughn) in [#21235](https://github.com/facebook/react/issues/21235)) ## 4.11.0 (April 9, 2021) #### Bugfix * `$r` should contain hooks property when it is `forwardRef` or `memo` component ([meowtec](https://github.com/meowtec) in [#20626](https://github.com/facebook/react/pull/20626))", "pos": ["Published has the following piece of code in : :roll_eyes:\nFYI\nHuh. That's no good.\nThis is because I accidentally put the module map in an map rather than a map. Oops.\nFix published in 4.11.1\nThanks!"], "neg": []} {"query": "expect(shallowRenderer.getMountedInstance().state).toBeNull(); }); it('should warn if both componentWillReceiveProps and static getDerivedStateFromProps exist', () => { class ComponentWithWarnings extends React.Component { state = {}; static getDerivedStateFromProps(props, prevState) { return null; } UNSAFE_componentWillReceiveProps(nextProps) {} render() { return null; } } const shallowRenderer = createRenderer(); expect(() => shallowRenderer.render()).toWarnDev( 'ComponentWithWarnings uses getDerivedStateFromProps() but also contains the following legacy lifecycles', ); // Should not log duplicate warning shallowRenderer.render(); }); it('should warn if getDerivedStateFromProps returns undefined', () => { class Component extends React.Component { state = {}; static getDerivedStateFromProps() {} render() { return null; } } const shallowRenderer = createRenderer(); expect(() => shallowRenderer.render()).toWarnDev( 'Component.getDerivedStateFromProps(): A valid state object (or null) must ' + 'be returned. You have returned undefined.', ); // De-duped shallowRenderer.render(); }); it('should warn if state not initialized before getDerivedStateFromProps', () => { class Component extends React.Component { static getDerivedStateFromProps() { return null; } render() { return null; } } const shallowRenderer = createRenderer(); expect(() => shallowRenderer.render()).toWarnDev( 'Component: Did not properly initialize state during construction. ' + 'Expected state to be an object, but it was undefined.', ); // De-duped shallowRenderer.render(); }); it('should invoke both deprecated and new lifecycles if both are present', () => { const log = [];", "pos": ["For consideration. These warnings are already covered by renderers based on react-reconciler. Maybe we don't gain that much by mirroring them in the shallow renderer? Maybe it's not worth the complexity? Particularly with more complicated warnings like the ones being for and ."], "neg": []} {"query": "\uac1c\ubc1c \ud558\ub2e4\ubcf4\uba74 CSS \uc18d\uc131\ub4e4\uc774 \ub2e8\uc704 \uc5c6\uc774 \uadf8\ub300\ub85c \uc720\uc9c0\ub418\uc5b4\uc57c \ud560 \ub54c\uac00 \uc788\uc744 \uac81\ub2c8\ub2e4. \uc544\ub798\uc758 \ud504\ub85c\ud37c\ud2f0\ub4e4\uc740 \uc790\ub3d9\uc73c\ub85c \"px\"\uac00 \ubd99\uc9c0 \uc54a\ub294 \uc18d\uc131 \ub9ac\uc2a4\ud2b8 \uc785\ub2c8\ub2e4: - `boxFlex` - `boxFlexGroup` - `columnCount` - `fillOpacity` - `flex` - `flexGrow` - `flexPositive` - `flexShrink` - `flexNegative` - `fontWeight` - `lineClamp` - `lineHeight`", "pos": ["The CSS property should not be getting a suffix automatically because a unit-less value can represent the number of spaces that make up the width in a tab. The JS name for this property is . See in the React docs.\nA solution for now is to use the which is pretty much equivalent.\nSounds like a good idea. Are you interested in creating a PR to add it?\nYes, the only thing I don't know is whether there needs to be anything special done to also include and handle object already in place\nWe autogenerate the vender-prefixed styles there (which you might have seen below where you changed code) so that's all you need to do! Thanks again."], "neg": []} {"query": "> > [Read the full post...](https://www.quora.com/Pete-Hunt/Posts/Facebooks-React-vs-AngularJS-A-Closer-Look) In the same vein, [Markov Twain](https://twitter.com/markov_twain/status/345702941845499906) re-implemented the examples on the front-page [with Ember](http://jsbin.com/azihiw/2/edit) and [Vlad Yazhbin](https://twitter.com/vla) re-implemented the tutorial [with Angular](https://jsfiddle.net/vla/Cdrse/). In the same vein, [Markov Twain](https://twitter.com/markov_twain/status/345702941845499906) re-implemented the examples on the front-page [with Ember](http://jsbin.com/azihiw/2/edit) and [Vlad Yazhbin](https://twitter.com/vla) re-implemented the tutorial [with Angular](http://jsfiddle.net/vla/Cdrse/). ## Web Components: React & x-tags", "pos": ["The Post gave an example of reconciliation by this . but It's not working, If I understand correctly, it should be something like . Should I create a PR by change the url to fix it?\nThe problem is that it is a https link for a fiddle that only supports http. There are actually more links with the same bug. Updating the fiddles would be one way to fix it, but that is a lot of work. And since the fiddles are part of old blog posts, it would be kind of like rewriting history. In my opinion the best way to fix it is reverting the links back to http. See for my proposed solution.\nI see, thank u\nI feel like the more 'correct'/'ideal' solution is to have the fiddle authors update their fiddles. That said, I don't feel too strongly, and will let make the decision on this."], "neg": []} {"query": "\"dependencies\": { \"commoner\": \"^0.10.0\", \"esprima-fb\": \"^6001.1.0-dev-harmony-fb\", \"jstransform\": \"^6.2.0\" \"jstransform\": \"^6.3.2\" }, \"devDependencies\": { \"benchmark\": \"~1.0.0\", \"browserify\": \"^4.1.10\", \"browserify\": \"^6.1.0\", \"coverify\": \"~1.0.4\", \"envify\": \"^2.0.0\", \"derequire\": \"^1.2.0\", \"envify\": \"^3.0.0\", \"es3ify\": \"~0.1.2\", \"es5-shim\": \"^4.0.0\", \"grunt\": \"~0.4.2\", \"grunt-cli\": \"~0.1.9\", \"grunt-compare-size\": \"~0.4.0\", \"grunt-contrib-clean\": \"~0.5.0\", \"grunt-contrib-compress\": \"^0.9.1\", \"grunt-contrib-clean\": \"^0.6.0\", \"grunt-contrib-compress\": \"^0.12.0\", \"grunt-contrib-connect\": \"~0.6.0\", \"grunt-contrib-copy\": \"~0.5.0\", \"grunt-contrib-copy\": \"^0.6.0\", \"grunt-contrib-jshint\": \"^0.10.0\", \"gzip-js\": \"~0.3.2\", \"jasmine-tapreporter\": \"~0.2.2\", \"jest-cli\": \"~0.1.5\", \"lodash\": \"~2.4.1\", \"microtime\": \"^0.6.0\", \"optimist\": \"~0.6.0\", \"phantomjs\": \"~1.9\", \"platform\": \"^1.1.0\", \"populist\": \"~0.1.6\", \"recast\": \"^0.6.10\", \"recast\": \"^0.7.2\", \"sauce-tunnel\": \"~1.1.0\", \"semver\": \"^2.3.0\", \"tmp\": \"~0.0.18\", \"uglify-js\": \"~2.4.0\", \"uglifyify\": \"^2.4.0\",", "pos": ["Do you want to request a feature or report a bug? It's more of a bug -- I don't think this behaviour should occur, but it's not a problem in production. What is the current behavior? Warning appears. 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: ). . I'll paste the code here too, just in case: What is the expected behavior? No warning. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? Fiddle uses React 15.0.1. Tested in Chrome on Ubuntu. I didn't test previous versions of React, but I suspect it's always been this way. Notes If I'm not mistaken, the HTML generated via cannot be updated by React because the essential DOM attributes are stripped away. This means that s should not be necessary because React will never need to match up the elements during a re-render. Supplying s that will never be used just to avoid a warning is tedious. Ergo, warning should be suppressed when JSX is rendered via .\nYeah, technically true. There were some talks a while back about potentially doing , in which case, and could become a single function because React wouldn't need any additional data in the DOM. That would make this don't-emit-key-warning difference much harder to justify. There is also something to be said for remaining consistent. If you are writing components that don't specify a key, then your components can't be shared/used with nor in the future (decreases reusability, increases fragmentation). Maybe it would be too opinionated for us to enforce that, but I could make the argument that maintaining a single cohesive component ecosystem is more important. Honestly, this would be pretty low priority for us. If you see an easy fix and want to submit a PR, I'd say it has a 50/50 chance (coin toss) of getting merged, probably depending primarily on complexity. We don't want to introduce any global state or do a whole ton of routing to decide if this warning needs to be emitted. Probably your best bet would be to move the warning to a devtool, and have the devtool become aware of what type of render is being performed.", "Nested renders would need to be considered. I'm going to close this out because this isn't a clear win for us, and it is almost certainly something that our team would not have the bandwidth to do internally. If someone in the community is passionate about fixing this, we'd take a look at any PRs, but can't make any promises a priori.\nThat's fair enough, I wouldn't rate it as high priority either. Thank you for taking the time to respond"], "neg": []} {"query": "this._updater, ); if (__DEV__) { if (typeof element.type.getDerivedStateFromProps === 'function') { if ( this._instance.state === null || this._instance.state === undefined ) { const componentName = getName(element.type, this._instance) || 'Unknown'; if (!didWarnAboutUninitializedState[componentName]) { warning( false, '%s: Did not properly initialize state during construction. ' + 'Expected state to be an object, but it was %s.', componentName, this._instance.state === null ? 'null' : 'undefined', ); didWarnAboutUninitializedState[componentName] = true; } } } } this._updateStateFromStaticLifecycle(element.props); if (element.type.hasOwnProperty('contextTypes')) {", "pos": ["For consideration. These warnings are already covered by renderers based on react-reconciler. Maybe we don't gain that much by mirroring them in the shallow renderer? Maybe it's not worth the complexity? Particularly with more complicated warnings like the ones being for and ."], "neg": []} {"query": "{ \"name\": \"react-devtools-inline\", \"version\": \"4.11.0\", \"version\": \"4.11.1\", \"description\": \"Embed react-devtools within a website\", \"license\": \"MIT\", \"main\": \"./dist/backend.js\",", "pos": ["Published has the following piece of code in : :roll_eyes:\nFYI\nHuh. That's no good.\nThis is because I accidentally put the module map in an map rather than a map. Oops.\nFix published in 4.11.1\nThanks!"], "neg": []} {"query": " /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @emails react-core * @jest-environment node */ 'use strict'; let ReactFeatureFlags; let React; let ReactNoop; let Scheduler; let Suspense; let useState; let useTransition; let act; describe('ReactHooksWithNoopRenderer', () => { beforeEach(() => { jest.resetModules(); ReactFeatureFlags = require('shared/ReactFeatureFlags'); ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false; ReactFeatureFlags.enableSchedulerTracing = true; ReactFeatureFlags.flushSuspenseFallbacksInTests = false; React = require('react'); ReactNoop = require('react-noop-renderer'); Scheduler = require('scheduler'); useState = React.useState; useTransition = React.useTransition; Suspense = React.Suspense; act = ReactNoop.act; }); function Text(props) { Scheduler.unstable_yieldValue(props.text); return props.text; } function createAsyncText(text) { let resolved = false; let Component = function() { if (!resolved) { Scheduler.unstable_yieldValue('Suspend! [' + text + ']'); throw promise; } return ; }; let promise = new Promise(resolve => { Component.resolve = function() { resolved = true; return resolve(); }; }); return Component; } it('isPending works even if called from outside an input event', async () => { const Async = createAsyncText('Async'); let start; function App() { const [show, setShow] = useState(false); const [startTransition, isPending] = useTransition(); start = () => startTransition(() => setShow(true)); return ( }> {isPending ? : null} {show ? : } ); } const root = ReactNoop.createRoot(); await act(async () => { root.render(); }); expect(Scheduler).toHaveYielded(['(empty)']); expect(root).toMatchRenderedOutput('(empty)'); await act(async () => { start(); expect(Scheduler).toFlushAndYield([ 'Pending...', '(empty)', 'Suspend! [Async]', 'Loading...', ]); expect(root).toMatchRenderedOutput('Pending...(empty)'); await Async.resolve(); }); expect(Scheduler).toHaveYielded(['Async']); expect(root).toMatchRenderedOutput('Async'); }); }); ", "pos": ["Do you want to request a feature or report a bug? Bug What is the current behavior? is never set to true when calling within , but it does work properly when within a . Here's the correct behavior (accomplished via ): ! Here's the incorrect behavior (via ): ! Note the difference is that the opacity never changes to 0.4 (which is determined based on the state). What is the expected behavior? I expect them to both behave the same (at least as far as the user can observe). Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? react react-dom\nI guess startTransition is never intended to be used in effects. I didn't expect it even works. Looking at the doc again, Hmm, it doesn't clearly say so.\nOk but the use cases is interesting.\nDo you think this is the same as\nYes, I believe that's the same issue.\nHello, I think I have a similar issue when using with . When returns a new value I would like to create a new resource. I tried to use for this, but I don't even have an idea where to put ...\nyou can see the isPending is if the is bigger than 5100 when calling in .\nI'm seeing the same behavior as - setting to a value of 5200 or higher causes to fire reliably in the original CodeSandbox:\nThat is a bug we need to fix regardless.\nFixed by . Updated Sandbox:"], "neg": []} {"query": " // Do not delete or move this file. // Many fiddles reference it so we have to keep it here. (function() { var tag = document.querySelector( 'script[type=\"application/javascript;version=1.7\"]' ); if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) { alert('Bad JSFiddle configuration, please fork the original React JSFiddle'); } tag.setAttribute('type', 'text/jsx;harmony=true'); tag.textContent = tag.textContent.replace(/^//", "pos": ["no longer works, and this causes all old fiddles like to break. We should fix it.\nI've also noticed fiddles[1][2] linking to being broken. I assume they were/are linking to the same place, but it's something to keep in mind. [1] [2] (All the examples seem to be broken)\nIt will take a few minutes to deploy the site but hopefully this should be fixed now.\nUnfortunately Recharts examples are broken because they don't specify the React version. So they accidentally \"updated\" to React 16 that has different file names. We could potentially fix this on our side by providing a fallback. But then, one of the most commonly used builds () doesn't even exist anymore. So this has to be fixed on their side anyway."], "neg": []} {"query": "Let's make the form interactive. When the user submits the form, we should clear it, submit a request to the server, and refresh the list of comments. To start, let's listen for the form's submit event and clear it. ```javascript{3-12,15,20} ```javascript{3-13,16,21} // tutorial16.js var CommentForm = React.createClass({ handleSubmit: React.autoBind(function() { var author = this.refs.author.getDOMNode().value.trim(); var text = this.refs.text.getDOMNode().value.trim(); if (!text || !author) { return; return false; } // TODO: send request to the server this.refs.author.getDOMNode().value = ''; this.refs.text.getDOMNode().value = ''; return false; }), render: function() { return (", "pos": ["Do you want to request a feature or report a bug? bug What is the current behavior? When using the latest Dev tools (v4.0.5) on my project, when I inspect react-redux elements that use connect() devtools crashes. I can't map from my crash to the actual source but the code is react devtools: up one level of stack is react: and up one level is react-redux: () 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: I'll have to try and make a small repro, but I hope there's something obvious given the info above. It's not clear to me if react-redux is doing something or if its devtools. This behavior existed in v3 and i was hoping it'd get magically fixed with v4 but it remains. What is the expected behavior? Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? This is in an electron app w/ react-redux v7.1.0 and react v16.8.3 (have to use this due to the version of react native i'm on)\nUnfortunately this is a bug with React that was fixed via PR and released with v16.8.4. Thank you for the detailed bug report though! Originally reported here:"], "neg": []} {"query": "{ \"name\": \"react-addons\", \"name\": \"react-addons-template\", \"version\": \"0.15.0-alpha\", \"main\": \"index.js\", \"repository\": \"facebook/react\", \"keywords\": [ \"react\", \"react-addon\" ], \"license\": \"BSD-3-Clause\", \"peerDependencies\": { \"react\": \"^0.15.0-alpha\"", "pos": ["Follow-up for : The react-addons-* packages should have a entry in their files."], "neg": []} {"query": "restorePendingUpdaters, addTransitionStartCallbackToPendingTransition, addTransitionCompleteCallbackToPendingTransition, setIsRunningInsertionEffect, } from './ReactFiberWorkLoop.old'; import { NoFlags as NoHookEffect,", "pos": ["Following up on (/cc ) React version: 18.0.0-rc.3-next-- an update (e.g. ) from within Link to code example: Update is applied and no warning is issued. According to cannot schedule updates. But seems to \"work\". Maybe this is just incidental because it's the first render? I got the impression that this should definitely cause a warning (not implemented) but I wonder if we also should consistently drop updates from ?"], "neg": []} {"query": "expectHookNamesToEqual(hookNames, ['foo', 'bar', 'baz']); }); it('should return null for hooks without names like useEffect', async () => { it('should skip loading source files for unnamed hooks like useEffect', async () => { const Component = require('./__source__/__untransformed__/ComponentWithUseEffect') .Component; // Since this component contains only unnamed hooks, the source code should not even be loaded. fetchMock.mockIf(/.+$/, request => { throw Error(`Unexpected file request for \"${request.url}\"`); }); const hookNames = await getHookNamesForComponent(Component); expectHookNamesToEqual(hookNames, []); // No hooks with names }); it('should skip loading source files for unnamed hooks like useEffect (alternate)', async () => { const Component = require('./__source__/__untransformed__/ComponentWithExternalUseEffect') .Component; fetchMock.mockIf(/.+$/, request => { // Since th custom hook contains only unnamed hooks, the source code should not be loaded. if (request.url.endsWith('useCustom.js')) { throw Error(`Unexpected file request for \"${request.url}\"`); } return Promise.resolve(requireText(request.url, 'utf8')); }); const hookNames = await getHookNamesForComponent(Component); expectHookNamesToEqual(hookNames, ['count', null]); // No hooks with names }); it('should parse names for custom hooks', async () => { const Component = require('./__source__/__untransformed__/ComponentWithNamedCustomHooks') .Component;", "pos": ["Hooks like or will never have names, so if a the only hooks for a given source file are these \"unnamed\" built-in hooks, we should skip loading the source code."], "neg": []} {"query": " # Reporting Security Issues If you believe you have found a security vulnerability in React, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem. Please refer to the following page for our responsible disclosure policy, reward guidelines, and those things that should not be reported: https://www.facebook.com/whitehat ", "pos": ["Feature requested GitHub has just released the Security Policy feature, by writing the file a new tab with security informations should appear in the repository. You can check the It will really improve people trusting in open source security standards\nAdded in the above commit"], "neg": []} {"query": "}); it('should warn when mutated props are passed', function() { var container = document.createElement('div'); class Foo extends React.Component { constructor(props) { var _props = { idx: props.idx + '!' }; super(_props); } render() { return ; } } expect(console.error.calls.length).toBe(0); ReactDOM.render(, container); expect(console.error.calls.length).toBe(1); expect(console.error.argsForCall[0][0]).toContain( 'Foo(...): When calling super() in `Foo`, make sure to pass ' + 'up the same props that your component's constructor was passed.' ); }); });", "pos": ["Having the constructor passing super a props object that differs (in object equality and/or shallow compare) from the original is... illegal, because: We should have a warning for that, because it's reasonable for someone to assume they could extend a component and modify the props, without considering the ramifications, and the bug won't show up in their initial render test but will show up when the component updates.\nCan a shallow comparison of and suffice, or is a deep equality check between the two objects needed?\nI think shallow is fine. Deep equality is too difficult/expensive because of cycles. Note that we should only do the check in dev mode, so surround your logic with a block"], "neg": []} {"query": "var getIteratorFn = require('getIteratorFn'); var monitorCodeUse = require('monitorCodeUse'); var warning = require('warning'); /** * Warn if there's no key explicitly set on dynamic arrays of children or", "pos": ["I spent the last hour trying to fix an issue that was caused by me trying to render a when the actual variable was undefined. The root cause was me misinterpreting that would return the whole instead of just (which is my bad), but the error itself and the stack trace were extremely cryptic and it took me a while to even get a clue that the reason why it wasn't working was that I was just trying to render an undefined type. This is the actual exception: And here's the stack trace: ! You can see that, ultimately, execution comes crashing down when React tries to look at on my undefined type, which of course raises an exception. The reason why this was confusing to me is that the exception happened quite far away from the source cause and, as a secondary factor, this code worked completely fine before I started porting it to Browserify and made my mistake with . This lead me to a wild set of hypotheses as to why it wasn't working, such as assuming it might be due to a regression in React 0.12 (since it's been migrating from to and I thought might have been lagging behind), to thinking it could be a problem with itself. The reason why I raise this issue is that, since passing an type won't work anyway, it would make sense if React could check for and warn about it or maybe even raise an exception (since it would crash soon after anyway). My instance was a bit more extreme and if something like this happens to someone else they'll probably know where they screwed up in the first place, but some help from React would always be welcome!\nActually returns the whole react lib + the addons. The addons are just to the object you'd get if you did . I've been using browserify the whole time and this error just came up, after updating to 0.12.1. It was working fine before, so it seems kind of weird that it's throwing an error right now. If a dev could comment on this, that'd be great.\nYea, seems like it wouldn't be a bad idea to have a check in createElement. What was working fine before? createElement didn't really exist (it was in 0.11.x but would likely not have been used). And react/addons has always been the full React object with addons inserted.\nTalked it through with on IRC, same cause just not via addons.", "An undefined component was being used.\nYeah, I became aware of that when I figured out what the issue is, I was just thinking it would have been way more helpful if React had told me straight away that I was passing an undefined component to .\n+1, I also had this issue (albeit for a different reason)\nThanks! :+1:\nIf you are giving the whole JSX code under the script tag of the HTML page, then the order of declaration of the components could cause this issue. When the inbuilt compiler sees a component which you've later declared in the code, it'll throw an error. However in plain terms, this just means that the component is missing.\nGetting this Uncaught TypeError: Cannot read property 'createElement' of undefined Any solutions\nPlease ask on StackOverflow; this is hard to answer without seeing your complete code.\nhere is my code ...\nis incorrect, should be There is no named export named . It is confusing because React is a CommonJS module, and since you\u2019re using ES6 imports, Babel tries to map the semantics but they don\u2019t match exactly. actually grabs from itself so you might just and use instead if it\u2019s less confusing.\nWoah, thank you for a nice clarification."], "neg": []} {"query": "}; /** * (For old IE.) Starts tracking propertychange events on the passed-in element * (For IE <=11) Starts tracking propertychange events on the passed-in element * and override the value property so that we can distinguish user events from * value changes in JS. */", "pos": ["Check: Tested in IE10. Likely related to .\nWe're having issues with this too and had to put in a workaround to deal with it. is this on your roadmap?\nHaving the same issue with on using IE 11.0.\nI have the same issue as when adding a placeholder a textarea, with no value, the onChange event is fired.\nI hava the same issue. A input with a placeholder and no value, the onChange event is fired.", "See for example code. When setting and removing focus from an empty field with some text, the event is triggered for IE 11 (I have not tested older versions). It does not trigger for other browsers. My current work-around is to test the that was last passed to the input with what is returned by , and only act if they are different, but it would be nice if React would not send the change-event in the first place.\nSounds like a browser quark that we should normalize against, right? Is there anything other than value that we would need to check?\nYeah, this seems odd. Probably on the challenging side for a first bug, but it would be good to figure out why this is happening and how we can prevent it, while still making it possible to type the placeholder text in directly as says.\n, not really related but I imagine both could be solved by a similar fix.\nAlso goes for IE10."], "neg": []} {"query": "return; } if (profilingData !== null) { if (profilingData !== null && downloadRef.current !== null) { const profilingDataExport = prepareProfilingDataExport(profilingData); const date = new Date(); const dateString = date", "pos": ["Hi, long time user, first time issuer. I think I found a bug with the Profiler component. When I click on the button at the top nothing happens and there appears to be no new files in my Downloads folder. I think it might be silently failing and that's why I am not getting any response. Has anyone else ran into this issue? Another thing I would like to mention is that I haven't looked through all of the documentation material about the new Profiler. I only read , so if this issue is addressed elsewhere I apologize and also request the source to that solution. Thank you for your time! Versions: *\nIt seems that this is happening because of the call in the util function. I'll investigate this further.\nI fixed the issue. I'll open a PR later today :)"], "neg": []} {"query": "// delete restores the original property definition delete activeElement.value; activeElement.detachEvent('onpropertychange', handlePropertyChange); if (activeElement.detachEvent) { activeElement.detachEvent('onpropertychange', handlePropertyChange); } else { activeElement.removeEventListener('propertychange', handlePropertyChange, false); } activeElement = null; activeElementID = null;", "pos": ["Check: Tested in IE10. Likely related to .\nWe're having issues with this too and had to put in a workaround to deal with it. is this on your roadmap?\nHaving the same issue with on using IE 11.0.\nI have the same issue as when adding a placeholder a textarea, with no value, the onChange event is fired.\nI hava the same issue. A input with a placeholder and no value, the onChange event is fired.", "See for example code. When setting and removing focus from an empty field with some text, the event is triggered for IE 11 (I have not tested older versions). It does not trigger for other browsers. My current work-around is to test the that was last passed to the input with what is returned by , and only act if they are different, but it would be nice if React would not send the change-event in the first place.\nSounds like a browser quark that we should normalize against, right? Is there anything other than value that we would need to check?\nYeah, this seems odd. Probably on the challenging side for a first bug, but it would be good to figure out why this is happening and how we can prevent it, while still making it possible to type the placeholder text in directly as says.\n, not really related but I imagine both could be solved by a similar fix.\nAlso goes for IE10."], "neg": []} {"query": "await test( './__source__/__compiled__/external/ComponentWithMultipleHooksPerLine', ); // external source map await test( './__source__/__compiled__/bundle', 'ComponentWithMultipleHooksPerLine', ); // bundle source map // await test( // './__source__/__compiled__/bundle', // 'ComponentWithMultipleHooksPerLine', // ); // bundle source map }); // TODO Inline require (e.g. require(\"react\").useState()) isn't supported yet.", "pos": ["Hooks like or will never have names, so if a the only hooks for a given source file are these \"unnamed\" built-in hooks, we should skip loading the source code."], "neg": []} {"query": "expect(Component.pqr()).toBe(Component.type); }); it('should throw if a reserved property is in statics', function() { expect(function() { React.createClass({ statics: { getDefaultProps: function() { return { foo: 0 }; } }, render: function() { return ; } }); }).toThrow( 'Invariant Violation: ReactCompositeComponent: You are attempting to ' + 'define a reserved property, `getDefaultProps`, that shouldn't be on ' + 'the \"statics\" key. Define it as an instance property instead; it ' + 'will still be accessible on the constructor.' ); }); it('should support statics in mixins', function() { var Mixin = { statics: {", "pos": ["This logs both and : This seems weird to me and inconsistent with the behavior for non-static functions. Can we change this to give an error too?"], "neg": []} {"query": "__source: true, }; var specialPropKeyWarningShown, specialPropRefWarningShown; /** * Factory method to create a new React element. This no longer adheres to * the class pattern, so do not use new to call it. Also, no instanceof check", "pos": ["The props and are reserved by React, and used internally. Component authors may attempt to access these properties (thinking they could read the value, as per ). We could use (in dev mode) to warn if or is accessed, and point the user to a note/discussion somewhere. That way, users who actually run into the issue will always get a timely message that sends them directly to the relevant explanation/discussion. This would be a good first bug, if we decide we actually want to do it.\nThis sounds like a great idea to me!\nYeah this seems reasonable.\nhi, I am interested in working on this; as I am looking forward to contribute. Kindly show me the way. Thanks in advance!\nTake a look at , that should give you a good start and a good idea of what we would be looking for.\nThanks Checking it out right away.\nI have taken a look at the pull request, and associated code review comments. It seems the warn-once policy is required here, as implemented in I am not sure I fully understand how this module achieves this, so I am reading it now. As per the code review comments in , I am using the URLs instead of StackOverflow URLs. But the comments over there also mentioned that the PR might break some test cases. I am not sure about the edge cases here. I feel like I could use some help on understanding this. Instead of using GitHub issue comments, is it possible to use some chat-platform such as IRC or slack room or Gitter?\nThe module achieves deduplication by setting a boolean if it has already warned. The comments about breaking tests are referring to the failing unit tests. Just run and to verify that everything is working before pushing your changes. There are many places where you can discuss, including the IRC channel and/or reactiflux. There are also github issues (which is what our core team predominantly uses), as well as several other channels. The community is pretty big, but nothing is quite as good as reading through the code and github issues, IMHO.\nSorry, I was away. is ready to be reviewed."], "neg": []} {"query": "--- id: getting-started-ja-JP title: \u59cb\u3081\u3066\u307f\u307e\u3057\u3087\u3046 permalink: getting-started-ja-JP.html next: tutorial-ja-JP.html redirect_from: \"docs/index-ja-JP.html\" ---", "pos": ["At gh-pages branch, there are and files. I think those file name must be and .\nThanks! I just pushed the change to the stable branch so this should be updated on the site and in the gh-pages branch as soon as it builds.\nThanks!"], "neg": []} {"query": "); } } return isConcurrentMode(object); return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; } export function isConcurrentMode(object: any) { return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;", "pos": ["It seems like react-is v16.6 no longer is compatible with React v16.3 - v16.5, in that React v16.3 - v16.5 will use , but 's export will instead be . It seems like the async mode symbol needs to remain the same in react-is 16.6+, and the function would need to check both the AsyncMode and ConcurrentMode symbols.\n(Note that this blocks full enzyme support of react v16.6)\nCan you explain more about the case in which it\u2019s breaking?\nsure - the enzyme react 16 adapter needs to maintain support for all versions of React 16. It provides a \"getDisplayNameOfNode\" function, which needs to be able to return the string in React 16.3-16.5 (for ), and the string in React 16.6+ (for ). It does this by comparing the to the or symbol exports from . In the 16.3-specific adapter, this isn't an issue, but it does have to lock the version of to (which is the breaking change part) - it should be able to keep working with react v16.3 and 16.anything. If v16.6+ had an symbol export that matched what React 16.3-16.5 did, then I think this wouldn't be a problem.\nIf react-is v16.6+ had an AsyncMode symbol export that matched what React 16.3-16.5 did, then I think this wouldn't be a problem. I think that sounds okay, we could do it. PR?\nSure, I'll try my hand at it!\nThis is our mistake because we should have prefixed isAsyncMode with unstable which the actual api was. Or not included it at all. We\u2019re treating unstable effectively as private and will break between minors. Are you ok with not supporting calls that are unstable_ in the future? Because we\u2019ll break them several times between releases and don\u2019t want to keep them all around in bundles.\nPrefix or not, renaming things is still going to break consumers. However, I understand react decides to accept this breakage in minor versions. Either way, the value of is that it abstracts over these kind of changes. \"Not including it at all\" would have meant I had to hardcode this stuff inside enzyme, which defeats the whole purpose of in the first place.", "In this case, the bundle size difference is negligible - when this is the case, it seems worth trying to keep back compat, even on things react has decided are effectively private.\nThe alternative is that we put it behind a feature flag and don\u2019t expose the featur at all. But then it\u2019s much harder for people to try it out for cases where breakages are ok. It\u2019s really hard for people in many environments to use alpha builds.\nI understand the dilemma. In this case, the functionality hasn't changed, and I'm not sure why it was renamed - iow i'm not sure how it helps people try it out to have the name change now, when it's still going to have to change again when it gets promoted to being stable. The tradeoffs seem to be somewhere between \"difficult for people to try it out\", \"cause breakage in some amount of downstream tooling\", or \"incur a tiny additional bundle cost to maintain back compat\". It's a tough call, and I'm not asking for a policy change - but in this case, the bundle size increase of seems pretty close to zero (i can't imagine it's more than a handful of bytes), and the benefit is that enzyme (and presumably other downstream tools) will be able to continue using without having to hardcode things."], "neg": []} {"query": "but does not invoke them.', -> spyOn console, 'error' getInitialStateWasCalled = false getDefaultPropsWasCalled = false class Foo extends React.Component constructor: -> @contextTypes = {}", "pos": ["I am working on a very simple component with default props. And I simply render it without any props (). But I got an empty object from console output. I am using react 0.13.1, chrome 41, OSX 10.10. Any idea what is going wrong?\nEs6 classes need defaultProps as a static property. Navigation.defaultProps = {...}\nThanks. Maybe update this in documentation :) ? I will be happy to send in a PR\nhas some commentary on docs and es6. I agree that I\u2019d like to see better docs on the class syntax. I\u2019m just a guy who happened to see your issue really quickly :)\ndoes reference this. It might be good to also put some documentation in to make it a bit easier to find. I'm going to close this out since it's invalid but I'd love to see a PR with more docs :)\nI think you should have also seen a runtime warning for this?\nnot really, though\nThanks, looks like an oversight. Fix incoming\u2026"], "neg": []} {"query": "return DevtoolsUI; } function setDisconnectedCallback(value: OnDisconnectedCallback) { disconnectedCallback = value; return DevtoolsUI; } let bridge: FrontendBridge | null = null; let store: Store | null = null; let root = null;", "pos": ["Any client that connects to the standalone DevTools While using the standalone DevTools app: a client to the DevTools that client and you should be redirected to the introduction page The event listeners are not re-attached to the splash page elements after the client disconnects. The if (isOutEvent && from && nativeEventTarget !== fromNode) { return [leave]; } return [leave, enter]; }, };", "pos": ["Do you want to request a feature or report a bug? I want to report a bug. What is the current behavior? Event handlers on elements are fired twice, when hovering from one element onto the next. 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? Event handlers should only fire once. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? React 16.8.4 ReactDOM 16.8.4 Chrome 76.0.3809.132 Firefox 69.0 (64-Bit) Edge 44..267.0\nAfter testing it again and again, I found how to reproduce it: Step 1, render a new component inside a rendered component; Step 2, inside the new component, mouse enter a node from its sibling. Current result: onMouseEnter is called more than once. Demo: We may change the issue title because it's not related with . I've made a test and fixture for this: Hope the information can be helpful. I still have no idea how to fix it. If there's no one working on this, I would like to pick this up. There's a similar issue Do you have any advice?\nGo for it,\nLet's close this? I see the fix was merged in ."], "neg": []} {"query": "`require('React')` statement in your code files and if you access React as a global. `react-to-react-dom` updates code for the split of the `react` and `react-dom` packages (e.g., `React.render` to `ReactDOM.render`). It looks for `require('react')` and replaces the appropriate property accesses using `require('react-dom')`. It does not support ES6 modules or other non-CommonJS systems. * `jscodeshift -t react/packages/react-codemod/transforms/react-to-react-dom.js ` * After running the automated codemod, you may want to run a regex-based find-and-replace to remove extra whitespace between the added requires, such as `codemod.py -m -d src --extensions js '(var Reacts*=s*require(.react.);)nn(s*var ReactDOM)' '1n2'` using https://github.com/facebook/codemod. ### Explanation of the ES2015 class transform * Ignore components with calls to deprecated APIs. This is very defensive, if", "pos": ["I tried doing the following to pick up react-dom: However, it said that the only version available was Poking around on Github yielded a repo called that appears to be linked to Bower. I'm guessing this isn't the right library; what's the dependency installation story going to look like with Bower?\nNever mind, just found that it shipped in the same package. However, the documentation is misleading on the :\nThanks, we should fix that."], "neg": []} {"query": "var args = [ \"bin/jsx\", \"--cache-dir\", \".module-cache\", \"--relativize\", config.sourceDir, config.outputDir ];", "pos": ["React version: 16.8.0 an app that toggles between rendering a text input and a date input. the of each to some arbitrary input, valid for either one toggling occurs that the value of the date input is not preserved upon toggle The date input's value is not preserved The date input's value should be preserved We discovered a simple workaround--add a unique property to each input, and the value will be respected.\nIt seems to be the default correct behaviour. You can read more about how works here. The reason it seems to work by adding the key prop is because the component gets re-rendered from scratch and therefore the \"works\". I think what you want to achieve is pretty date display when not in edit mode. Maybe something like this. Demo Prototype code\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!"], "neg": []} {"query": "node = domComponentOrNode; } var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType]; var fakeNativeEvent = new Event(); fakeNativeEvent.target = node; // We don't use SyntheticEvent.getPooled in order to not have to worry about // properly destroying any properties assigned from `eventData` upon release var event = new SyntheticEvent( ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType], dispatchConfig, ReactMount.getID(node), fakeNativeEvent ); assign(event, eventData); EventPropagators.accumulateTwoPhaseDispatches(event); if (dispatchConfig.phasedRegistrationNames) { EventPropagators.accumulateTwoPhaseDispatches(event); } else { EventPropagators.accumulateDirectDispatches(event); } ReactUpdates.batchedUpdates(function() { EventPluginHub.enqueueEvents(event);", "pos": ["While testing I wanted to simulate and events, but for some reason they are not firing the handlers in the component. Here's a fiddle to show you: You'll see that with the Simulate functions, only the click is actually triggered, while the other ones not. With the real events everything works perfectly. I tried to debug a little bit what's going on, but didn't get much information, especially since it's the first time I'm diving into the events mechanism internals in React. If you want more info, then I can try and dig a bit deeper, but I think the fiddle is clear enough.\nYeah, unfortunately mouseEnter/mouseLeave don't get simulated properly at the moment due to their unique bubbling situation. The biggest blocker here is picking a good API, I think. Maybe just ?\nWhy should the user care about where the mouse moves from/to? Perhaps this can be handled internally? Is the problem due to bubbling here? I may need to dive into the code a little more to get a better understanding and stop saying nonsense :P\nYes, it's due to bubbling. If you have the DOM structure and your mouse moves from C to D, then C and B receive mouseleave events, D receives a mouseenter event, and A receives nothing. All other events bubble up to the root. Perhaps it's good enough to just make simulated mouseEnter and mouseLeave events not bubble at all.\nThat would work at least where I was trying to test. While testing I generally don't need anything too complex, just making sure the right behavior triggers when the event happens. Hopefully that's the way others do as well\n(As a workaround for now, you can use SimulateNative.mouseOver and SimulateNative.mouseOut (making sure to specify relatedTarget appropriately on each) and together they will cause React to fire onMouseEnter and onMouseLeave events.)\nDo we have a good solution for such case now? I'm trying my solution but feeling so tricky. And I got still quite strange results:\ncan you give an example. I can't find any documentation on SimulateNative or how to set relatedTarget appropriately?\nYou want to do something like this: The simulates the mouse moving one element another. The element can be anything really, it\u2019s not important.\nDo we have a good solution for such case now? or It can not be solved?", "I am manually applying this patch until it is pulled into the core:\nAny update on this?\nI was able to get my tests to pass using SimulateNative. Here's my codez: Test results:\nI tried that using both and instead of but it still did not trigger my event.\nIf it helps - the difference which worked for me was calling with a and not a . Pass & fail states listed along with full test case below: This seems to also work:\nNo update so far? Maybe some workarounds?\nThis was fixed in in April as you can see a few messages up; it'll be in the 0.14 release. If you search \"workaround\" on this page you'll see that I also posted a workaround over a year ago.\nSorry, really missed it. Thanks for it!"], "neg": []} {"query": "return children; } function makeDelayedText() { let error, _resolve, _reject; let promise = new Promise((resolve, reject) => { _resolve = () => { promise = null; resolve(); }; _reject = e => { error = e; promise = null; reject(e); }; }); function DelayedText({children}, data) { if (promise) { throw promise; } if (error) { throw error; } return {children}; } return [DelayedText, _resolve, _reject]; } const [Friends, resolveFriends] = makeDelayedText(); const [Name, resolveName] = makeDelayedText(); const [Posts, resolvePosts] = makeDelayedText(); const [Photos, resolvePhotos] = makeDelayedText(); const [Games, , rejectGames] = makeDelayedText(); const [Friends, resolveFriends] = makeDelayedText(Text); const [Name, resolveName] = makeDelayedText(Text); const [Posts, resolvePosts] = makeDelayedText(Text); const [Photos, resolvePhotos] = makeDelayedText(Text); const [Games, , rejectGames] = makeDelayedText(Text); // View function ProfileDetails({avatar}) {", "pos": ["When using for e.g. Cloudflare Workers runtimes, I'm noticing this error on the server: I'm assuming this results in the following malformed chunk being sent to the stream: Which results in the client failing: I put together a reproduction here, powered by for the Workers runtime: Could this be related to the \"fundamentally flawed\" nature of Web Streams implementations in e.g. Cloudflare Workers runtime? Is something going on with corking/uncorking, as per Maybe something's wrong with Miniflare's polyfill and this is a non-issue, coming from ? Finally, it's possible something is wrong with the Vite version of the example I've put together. I could try rebuilding with webpack if it's determined none of these items apply.\nHave you looked at what chain of assumptions leads to this? It seems like it would be good to understand what different state machines are involved and why something's happening in CF that doesn't happen in the browser.\nHave you looked at what chain of assumptions leads to this? after lots of digging, here's what we've discovered: The difference between Cloudflare/Oxygen Workers runtimes and the browser comes down to how the is consumed after being passed to . In the browser and , this is how the stream (via ) is consumed: This presumably results in a single . In the worker runtime, is read through an : Importantly, this results in getting called multiple times as more data is enqueued and as the reader sees fit. This is an assumption on my part, so I could be wrong here. When combined with Suspense boundaries, callbacks trigger . At the same time, repeated requests from the stream reader also call . This results in the following error on the server: You can also reproduce this directly in the browser by attempting to read the stream with . Here is a new fixture with a reproduction of the issue, including a couple test cases that show the different errors you'll see based on the number of Suspense boundaries you have: If this seems like a legitimate bug to you, a couple ideas I had: Should there be some sort of check like in ? Should we splice completed boundaries earlier to account for concurrency so they are removed from the array and not re-flushed? Here are some other resources and scratch notes:\n~We'll fix this reentrancy bug somehow.", "However, right now it's a bit lower priority because CloudFlare technically don't support ReadableStreams and so you have to go through the polyfill and any subtle differences might be due to the polyfill. To really know if we fixed this issue we should apply this to native CloudFlare ReadableStreams... which I'm told is coming. So that's how we know if it actually worked. Until then, the support for CloudFlare workers is... partial.~ On a second thought this should probably fix it. I think I finally understand how it's supposed to work now.\nPlease take another look and see if this fixes all the issues you've noticed.\nworks like a charm! Thanks for taking the time to look at it and get it fixed"], "neg": []} {"query": "} /** * Sets the text content of `node` to `text`. * * @param {DOMElement} node Node to change * @param {string} text New text content */ var updateTextContent; if (textContentAccessor === 'textContent') { updateTextContent = function(node, text) { node.textContent = text; }; } else { updateTextContent = function(node, text) { // In order to preserve newlines correctly, we can't use .innerText to set // the contents (see #1080), so we empty the element then append a text node while (node.firstChild) { node.removeChild(node.firstChild); } if (text) { var doc = node.ownerDocument || document; node.appendChild(doc.createTextNode(text)); } }; } /** * Operations for updating with DOM children. */ var DOMChildrenOperations = { dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, updateTextContent: updateTextContent, /** * Updates a component's children by processing a series of updates. The * update configurations are each expected to have a `parentNode` property.", "pos": ["On re-render, we innerText. This causes inconsistencies in rendering whitespace. See demo: We should make sure this doesn't happen.\nWe switched to use but it broke some contentEditable stuff internal to FB. knows more.\nI'm switching it back (D1174395), but regardless, this is an innerText issue. Browsers that don't have textcontent (ie8) suffer\nlooks like this was brought up in\nRight, we should also do the right thing in IE8.\njQuery empties then adds a text node. Relevant commits: ()\nokay interesting. I'll do this for ie8\nI have a patch almost ready.\nI'm curious if is a simpler solution to the newline problem (for IE8), or if that only works for innerHTML.\nhmm interesting. We definitely want to preserve whitespace though. (because of and and )"], "neg": []} {"query": "{withoutStack: true}, ); }); it('does not call lazy initializers eagerly', () => { let didCall = false; const Lazy = React.lazy(() => { didCall = true; return {then() {}}; }); React.createElement(Lazy); expect(didCall).toBe(false); }); });", "pos": ["Hello
Component
', ); suspend = true; client = true; ReactDOMClient.hydrateRoot(container, , { onRecoverableError(error) { Scheduler.log(error.message); }, }); await waitForAll(['Suspend']); jest.runAllTimers(); // !! Unchanged, continue showing server content while suspended. expect(container.innerHTML).toBe( 'Hello
Component
', ); suspend = false; resolve(); await promise; await waitForAll([ // first pass, mismatches at end 'Hello', 'Component', 'Hello', 'Component', 'Hydration failed because the initial UI does not match what was rendered on the server.', 'There was an error while hydrating this Suspense boundary. Switched to client rendering.', ]); jest.runAllTimers(); // Client rendered - suspense comment nodes removed. expect(container.innerHTML).toBe('Hello
Mismatch
'); if (__DEV__) { const secondToLastCall = mockError.mock.calls[mockError.mock.calls.length - 2]; expect(secondToLastCall).toEqual([ 'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', 'article', 'section', 'n' + ' in article (at **)n' + ' in Component (at **)n' + ' in Suspense (at **)n' + ' in App (at **)', ]); } } finally { console.error = originalConsoleError; } }); it('does not show a fallback if mismatch is child of suspended component', async () => { // We can't use the toErrorDev helper here because this is async. const originalConsoleError = console.error; const mockError = jest.fn(); console.error = (...args) => { mockError(...args.map(normalizeCodeLocInfo)); }; let client = false; let suspend = false; let resolve; const promise = new Promise(resolvePromise => { resolve = () => { suspend = false; resolvePromise(); }; }); function Child({children}) { if (suspend) { Scheduler.log('Suspend'); throw promise; } else { Scheduler.log('Hello'); return
{children}
; } } function Component({shouldMismatch}) { Scheduler.log('Component'); if (shouldMismatch && client) { return
Mismatch
; } return
Component
; } function Fallback() { Scheduler.log('Fallback'); return 'Loading...'; } function App() { return ( }> ); } try { const finalHTML = ReactDOMServer.renderToString(); const container = document.createElement('section'); container.innerHTML = finalHTML; assertLog(['Hello', 'Component']); expect(container.innerHTML).toBe( '
Component
', ); suspend = true; client = true; ReactDOMClient.hydrateRoot(container, , { onRecoverableError(error) { Scheduler.log(error.message); }, }); await waitForAll(['Suspend']); jest.runAllTimers(); // !! Unchanged, continue showing server content while suspended. expect(container.innerHTML).toBe( '
Component
', ); suspend = false; resolve(); await promise; await waitForAll([ // first pass, mismatches at end 'Hello', 'Component', 'Hello', 'Component', 'Hydration failed because the initial UI does not match what was rendered on the server.', 'There was an error while hydrating this Suspense boundary. Switched to client rendering.', ]); jest.runAllTimers(); // Client rendered - suspense comment nodes removed expect(container.innerHTML).toBe( '
Mismatch
', ); if (__DEV__) { const secondToLastCall = mockError.mock.calls[mockError.mock.calls.length - 2]; expect(secondToLastCall).toEqual([ 'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', 'article', 'div', 'n' + ' in article (at **)n' + ' in Component (at **)n' + ' in div (at **)n' + ' in Child (at **)n' + ' in Suspense (at **)n' + ' in App (at **)', ]); } } finally { console.error = originalConsoleError; } }); it('does not show a fallback if mismatch is parent and first child suspends', async () => { // We can't use the toErrorDev helper here because this is async. const originalConsoleError = console.error; const mockError = jest.fn(); console.error = (...args) => { mockError(...args.map(normalizeCodeLocInfo)); }; let client = false; let suspend = false; let resolve; const promise = new Promise(resolvePromise => { resolve = () => { suspend = false; resolvePromise(); }; }); function Child({children}) { if (suspend) { Scheduler.log('Suspend'); throw promise; } else { Scheduler.log('Hello'); return
{children}
; } } function Component({shouldMismatch, children}) { Scheduler.log('Component'); if (shouldMismatch && client) { return (
{children}
Mismatch
); } return (
{children}
Component
); } function Fallback() { Scheduler.log('Fallback'); return 'Loading...'; } function App() { return ( }> ); } try { const finalHTML = ReactDOMServer.renderToString(); const container = document.createElement('section'); container.innerHTML = finalHTML; assertLog(['Component', 'Hello']); expect(container.innerHTML).toBe( '
Component
', ); suspend = true; client = true; ReactDOMClient.hydrateRoot(container, , { onRecoverableError(error) { Scheduler.log(error.message); }, }); await waitForAll(['Component', 'Suspend']); jest.runAllTimers(); // !! Unchanged, continue showing server content while suspended. expect(container.innerHTML).toBe( '
Component
', ); suspend = false; resolve(); await promise; await waitForAll([ // first pass, mismatches at end 'Component', 'Hello', 'Component', 'Hello', 'Hydration failed because the initial UI does not match what was rendered on the server.', 'There was an error while hydrating this Suspense boundary. Switched to client rendering.', ]); jest.runAllTimers(); // Client rendered - suspense comment nodes removed expect(container.innerHTML).toBe( '
Mismatch
', ); if (__DEV__) { const secondToLastCall = mockError.mock.calls[mockError.mock.calls.length - 2]; expect(secondToLastCall).toEqual([ 'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', 'article', 'div', 'n' + ' in article (at **)n' + ' in div (at **)n' + ' in Component (at **)n' + ' in Suspense (at **)n' + ' in App (at **)', ]); } } finally { console.error = originalConsoleError; } }); it('does show a fallback if mismatch is parent and second child suspends', async () => { // We can't use the toErrorDev helper here because this is async. const originalConsoleError = console.error; const mockError = jest.fn(); console.error = (...args) => { mockError(...args.map(normalizeCodeLocInfo)); }; let client = false; let suspend = false; let resolve; const promise = new Promise(resolvePromise => { resolve = () => { suspend = false; resolvePromise(); }; }); function Child({children}) { if (suspend) { Scheduler.log('Suspend'); throw promise; } else { Scheduler.log('Hello'); return
{children}
; } } function Component({shouldMismatch, children}) { Scheduler.log('Component'); if (shouldMismatch && client) { return (
Mismatch
{children}
); } return (
Component
{children}
); } function Fallback() { Scheduler.log('Fallback'); return 'Loading...'; } function App() { return ( }> ); } try { const finalHTML = ReactDOMServer.renderToString(); const container = document.createElement('section'); container.innerHTML = finalHTML; assertLog(['Component', 'Hello']); expect(container.innerHTML).toBe( '
Component
', ); suspend = true; client = true; ReactDOMClient.hydrateRoot(container, , { onRecoverableError(error) { Scheduler.log(error.message); }, }); await waitForAll([ 'Component', 'Component', 'Suspend', 'Fallback', 'Hydration failed because the initial UI does not match what was rendered on the server.', 'There was an error while hydrating this Suspense boundary. Switched to client rendering.', ]); jest.runAllTimers(); // !! Client switches to suspense fallback. expect(container.innerHTML).toBe('Loading...'); suspend = false; resolve(); await promise; await waitForAll(['Component', 'Hello']); jest.runAllTimers(); // Client rendered - suspense comment nodes removed expect(container.innerHTML).toBe( '
Mismatch
', ); if (__DEV__) { const secondToLastCall = mockError.mock.calls[mockError.mock.calls.length - 2]; expect(secondToLastCall).toEqual([ 'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', 'article', 'div', 'n' + ' in article (at **)n' + ' in div (at **)n' + ' in Component (at **)n' + ' in Suspense (at **)n' + ' in App (at **)', ]); } } finally { console.error = originalConsoleError; } }); it('does show a fallback if mismatch is in parent element only', async () => { // We can't use the toErrorDev helper here because this is async. const originalConsoleError = console.error; const mockError = jest.fn(); console.error = (...args) => { mockError(...args.map(normalizeCodeLocInfo)); }; let client = false; let suspend = false; let resolve; const promise = new Promise(resolvePromise => { resolve = () => { suspend = false; resolvePromise(); }; }); function Child({children}) { if (suspend) { Scheduler.log('Suspend'); throw promise; } else { Scheduler.log('Hello'); return
{children}
; } } function Component({shouldMismatch, children}) { Scheduler.log('Component'); if (shouldMismatch && client) { return
{children}
; } return
{children}
; } function Fallback() { Scheduler.log('Fallback'); return 'Loading...'; } function App() { return ( }> ); } try { const finalHTML = ReactDOMServer.renderToString(); const container = document.createElement('section'); container.innerHTML = finalHTML; assertLog(['Component', 'Hello']); expect(container.innerHTML).toBe( '
', ); suspend = true; client = true; ReactDOMClient.hydrateRoot(container, , { onRecoverableError(error) { Scheduler.log(error.message); }, }); await waitForAll([ 'Component', 'Component', 'Suspend', 'Fallback', 'Hydration failed because the initial UI does not match what was rendered on the server.', 'There was an error while hydrating this Suspense boundary. Switched to client rendering.', ]); jest.runAllTimers(); // !! Client switches to suspense fallback. expect(container.innerHTML).toBe('Loading...'); suspend = false; resolve(); await promise; await waitForAll(['Component', 'Hello']); jest.runAllTimers(); // Client rendered - suspense comment nodes removed expect(container.innerHTML).toBe('
'); if (__DEV__) { const secondToLastCall = mockError.mock.calls[mockError.mock.calls.length - 2]; expect(secondToLastCall).toEqual([ 'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', 'article', 'section', 'n' + ' in article (at **)n' + ' in Component (at **)n' + ' in Suspense (at **)n' + ' in App (at **)', ]); } } finally { console.error = originalConsoleError; } }); it('does show a fallback if mismatch is before suspending', async () => { // We can't use the toErrorDev helper here because this is async. const originalConsoleError = console.error; const mockError = jest.fn(); console.error = (...args) => { mockError(...args.map(normalizeCodeLocInfo)); }; let client = false; let suspend = false; let resolve; const promise = new Promise(resolvePromise => { resolve = () => { suspend = false; resolvePromise(); }; }); function Child() { if (suspend) { Scheduler.log('Suspend'); throw promise; } else { Scheduler.log('Hello'); return 'Hello'; } } function Component({shouldMismatch}) { Scheduler.log('Component'); if (shouldMismatch && client) { return
Mismatch
; } return
Component
; } function Fallback() { Scheduler.log('Fallback'); return 'Loading...'; } function App() { return ( }> ); } try { const finalHTML = ReactDOMServer.renderToString(); const container = document.createElement('section'); container.innerHTML = finalHTML; assertLog(['Component', 'Hello']); expect(container.innerHTML).toBe( '
Component
Hello', ); suspend = true; client = true; ReactDOMClient.hydrateRoot(container, , { onRecoverableError(error) { Scheduler.log(error.message); }, }); await waitForAll([ 'Component', 'Component', 'Suspend', 'Fallback', 'Hydration failed because the initial UI does not match what was rendered on the server.', 'There was an error while hydrating this Suspense boundary. Switched to client rendering.', ]); jest.runAllTimers(); // !! Client switches to suspense fallback. expect(container.innerHTML).toBe('Loading...'); suspend = false; resolve(); await promise; await waitForAll([ // first pass, mismatches at end 'Component', 'Hello', ]); jest.runAllTimers(); // Client rendered - suspense comment nodes removed expect(container.innerHTML).toBe('
Mismatch
Hello'); if (__DEV__) { const secondToLastCall = mockError.mock.calls[mockError.mock.calls.length - 2]; expect(secondToLastCall).toEqual([ 'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', 'article', 'section', 'n' + ' in article (at **)n' + ' in Component (at **)n' + ' in Suspense (at **)n' + ' in App (at **)', ]); } } finally { console.error = originalConsoleError; } }); it('does show a fallback if mismatch is before suspending in a child', async () => { // We can't use the toErrorDev helper here because this is async. const originalConsoleError = console.error; const mockError = jest.fn(); console.error = (...args) => { mockError(...args.map(normalizeCodeLocInfo)); }; let client = false; let suspend = false; let resolve; const promise = new Promise(resolvePromise => { resolve = () => { suspend = false; resolvePromise(); }; }); function Child() { if (suspend) { Scheduler.log('Suspend'); throw promise; } else { Scheduler.log('Hello'); return 'Hello'; } } function Component({shouldMismatch}) { Scheduler.log('Component'); if (shouldMismatch && client) { return
Mismatch
; } return
Component
; } function Fallback() { Scheduler.log('Fallback'); return 'Loading...'; } function App() { return ( }>
); } try { const finalHTML = ReactDOMServer.renderToString(); const container = document.createElement('section'); container.innerHTML = finalHTML; assertLog(['Component', 'Hello']); expect(container.innerHTML).toBe( '
Component
Hello
', ); suspend = true; client = true; ReactDOMClient.hydrateRoot(container, , { onRecoverableError(error) { Scheduler.log(error.message); }, }); await waitForAll([ 'Component', 'Component', 'Suspend', 'Fallback', 'Hydration failed because the initial UI does not match what was rendered on the server.', 'There was an error while hydrating this Suspense boundary. Switched to client rendering.', ]); jest.runAllTimers(); // !! Client switches to suspense fallback. expect(container.innerHTML).toBe('Loading...'); suspend = false; resolve(); await promise; await waitForAll([ // first pass, mismatches at end 'Component', 'Hello', ]); jest.runAllTimers(); // Client rendered - suspense comment nodes removed. expect(container.innerHTML).toBe( '
Mismatch
Hello
', ); if (__DEV__) { const secondToLastCall = mockError.mock.calls[mockError.mock.calls.length - 2]; expect(secondToLastCall).toEqual([ 'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', 'article', 'section', 'n' + ' in article (at **)n' + ' in Component (at **)n' + ' in Suspense (at **)n' + ' in App (at **)', ]); } } finally { console.error = originalConsoleError; } }); it('calls the hydration callbacks after hydration or deletion', async () => { let suspend = false; let resolve;", "pos": ["React version: 18.2.0 a tiny app that uses + suspends during hydration + has a hydration mismatch, for example: (Full code in ) the app and observe that the suspense fallback is never mounted , wrap the element with a : () the app and observe that the suspense fallback is now mounted Code example: \u00b7 The fallback is rendered inconsistently \u2013 depending on whether the element that suspends is wrapped with a ?! The fallback is rendered either never, or always, no matter if the element that suspends is wrapped with anything.\nSpent a bunch of time debugging this, and I think I understand what\u2019s causing this. Let\u2019s say we\u2019re trying to hydrate the following tree: Here\u2019s why the bug happens: hydrating the tree, React enters the and starts walking its children. At some point, it walks over the node \u2013 and encounters a hydration mismatch. This causes React to find the nearest suspense boundary and . (Later, and switches the boundary to client-side rendering, .) , after setting the flag, React does not switch the to client rendering immediately. Instead, it walks the remaining siblings (in this case, two s and ) and then exits the subtree. is where the inconsistency lies. In the normal case (without ), React finishes walking all siblings, walks back up to , realizes that has set, and client-renders again from scratch. However, if one of the siblings React walks over () suspends, React . This effectively disables mismatch handling (until later) \u2013 instead, suspends, as if there was no hydration mismatch. And because it\u2019s still hydrating, Suspense keeps the server HTML instead of rendering the fallback. This behavior disappears if lives in another part of the tree (not in direct siblings): With this tree, React won\u2019t walk over (because it\u2019s inside a sibling, and React won\u2019t enter siblings after it encountered a hydration error). This means React will follow the normal code path \u2192 re-render the Suspense boundary from scratch instead of hydrating it \u2192 suspend that boundary when it finally encounters \u2192 and render the Suspense fallback. a result, if is a direct sibling to the hydration mismatch, React will keep the server HTML until the component unsuspends. If it\u2019s not, React will render the Suspense fallback.", "This is (imo) the bug: React\u2019s behavior shouldn\u2019t depend on where inside the boundary the hydration mismatch happens. Just from the code perspective, it feels easier/cheaper to keep the \u201cnormal\u201d case \u2013 always resetting the boundary if there\u2019s a hydration mismatch. This also matches that says that is rerendered from scratch on a mismatch \u2013 this is good because every edge case is an overhead that devs need to learn. But from the UX perspective, I\u2019d maybe prefer React to keep the server HTML until the boundary unsuspends? If we keep the server HTML, the UI will go through two states: Server HTML \u2192 Client HTML. Both of these should be similar, despite a minor hydration mismatch. If we reset the boundary, the UI will jump through Server HTML \u2192 \u201cLoading...\u201d fallback \u2192 Client HTML, which feels like a worse UX. IDK, feels like a hard choice to make (good thing it\u2019s not mine I guess ^_^)\nSorry for the direct ping \u2013 I see you referenced this bug in some other PR; any chance this bug can be set to \u201cConfirmed\u201d? (It still reproduces even in )\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!"], "neg": []} {"query": "*/ var ReactDOMSelect = { getNativeProps: function(inst, props) { return Object.assign({}, props, { return Object.assign({}, DisabledInputUtils.getNativeProps(inst, props), { onChange: inst._wrapperState.onChange, value: undefined, });", "pos": ["The same in Chrome 35.0.1916.153. It's OK in Chrome Canary 38.0.2082.0 canary (64-bit).\nThis is actually an - we've the workarounds to make sure disabled s actually behave correctly here. This holds for all disabled inputs it seems."], "neg": []} {"query": "if ( elementType === ElementTypeFunction || elementType === ElementTypeClass || elementType === ElementTypeContext elementType === ElementTypeContext || elementType === ElementTypeMemo || elementType === ElementTypeForwardRef ) { // Otherwise if this is a traced ancestor, flag for the nearest host descendant(s). traceNearestHostComponentUpdate = didFiberRender(", "pos": [" ### displayName ```javascript string displayName ``` The `displayName` string is used in debugging messages. JSX sets this value automatically, see [JSX in Depth](react/docs/jsx-in-depth.html#react-composite-components). ## Lifecycle Methods Various methods are executed at specific points in a component's lifecycle.", "pos": ["I couldn't find a reference to the fact that jsx transform attaches to the component spec, this would be nice to document somewhere (more importantly, that not using jsx means debugging messages will be littered with ). I found this while using .\nThat would be very nice indeed. If you want to take a stab at it, the docs are in the repo in the markdown format. Would love to have you on the contributor list :)"], "neg": []} {"query": "); if (__DEV__) { const inst = workInProgress.stateNode; if (inst.props !== nextProps) { if (shouldUpdate && inst.props !== nextProps) { if (!didWarnAboutReassigningProps) { console.error( 'It looks like %s is reassigning its own `this.props` while rendering. ' +", "pos": ["", "pos": ["Not reporting a bug or issue. I just wanted to let you know I found this part of the walk-through to be unclear and confusing and others may, too: It took me a while to figure out whether I was supposed to be editing in the file provided when I cloned the repo or whether I should make a new file and how to link the two files if they were both necessary. I'm new to React and pretty new to programming overall, but I do have some Javascript and Javascript framework experience. I really enjoyed the walk-through because it was simple to get started, so thanks for the helpful resource!!\nGood catch & thanks for the heads up! I'd definitely call that a bug :) We really need to go through the tutorial and make sure it's all cohesive. After 2 years of ad hoc updating it's definitely showing its age. If you have any other feedback (especially as somebody who is relatively new to programming), we'd definitely appreciate it.\nNo problem! I'm happy to help. Will definitely let you know if I see anything else. Thanks again for the great resources!\nI've opened a PR with a minor change to make the bit that mentioned a little easier to follow. +1 on making sure the tutorial is cohesive. What are your thoughts on bringing the actual tutorial as a sub-directory of the React project as opposed to being in a separate repository? I am not even sure myself if that's the best way to go about it, but at least things wouldn't be going out of sync as they are now. If you look at the source code for the tutorial and compare it to the tutorial instructions in the React repo there are some striking differences which might catch people out. The major drawback with this approach would be having to clone the entire React source when you want to get just the tutorial, but I actually don't think that's a bad idea. It might even encourage people to have a poke about the source code, which is always a good thing."], "neg": []} {"query": "expect(aUpdated).toBe(true); }); it('should flush updates in the correct order', function() { var updates = []; var Outer = React.createClass({ getInitialState: function() { return {x: 0}; }, render: function() { updates.push('Outer-render-' + this.state.x); return
; }, componentDidUpdate: function() { var x = this.state.x; updates.push('Outer-didUpdate-' + x); updates.push('Inner-setState-' + x); this.refs.inner.setState({x: x}, function() { updates.push('Inner-callback-' + x); }); } }); var Inner = React.createClass({ getInitialState: function() { return {x: 0}; }, render: function() { updates.push('Inner-render-' + this.props.x + '-' + this.state.x); return
; }, componentDidUpdate: function() { updates.push('Inner-didUpdate-' + this.props.x + '-' + this.state.x); } }); var instance = ReactTestUtils.renderIntoDocument(); updates.push('Outer-setState-1'); instance.setState({x: 1}, function() { updates.push('Outer-callback-1'); updates.push('Outer-setState-2'); instance.setState({x: 2}, function() { updates.push('Outer-callback-2'); }); }); expect(updates).toEqual([ 'Outer-render-0', 'Inner-render-0-0', 'Outer-setState-1', 'Outer-render-1', 'Inner-render-1-0', 'Inner-didUpdate-1-0', 'Outer-didUpdate-1', 'Inner-setState-1', 'Inner-render-1-1', 'Inner-didUpdate-1-1', 'Inner-callback-1', 'Outer-callback-1', 'Outer-setState-2', 'Outer-render-2', 'Inner-render-2-1', 'Inner-didUpdate-2-1', 'Outer-didUpdate-2', 'Inner-setState-2', 'Inner-render-2-2', 'Inner-didUpdate-2-2', 'Inner-callback-2', 'Outer-callback-2' ]); }); it('should queue nested updates', function() { // See https://github.com/facebook/react/issues/1147 var X = React.createClass({ getInitialState: function() { return {s: 0}; }, render: function() { if (this.state.s === 0) { return
0
; } else { return
1
; } }, go: function() { this.setState({s: 1}); this.setState({s: 0}); this.setState({s: 1}); } }); var Y = React.createClass({ render: function() { return
; } }); var Z = React.createClass({ render: function() { return
; }, componentWillUpdate: function() { x.go(); } }); var x; var y; x = ReactTestUtils.renderIntoDocument(); y = ReactTestUtils.renderIntoDocument(); expect(x.getDOMNode().textContent).toBe('0'); y.forceUpdate(); expect(x.getDOMNode().textContent).toBe('1'); }); it('should queue updates from during mount', function() { // See https://github.com/facebook/react/issues/1353 var a; var A = React.createClass({ getInitialState: function() { return {x: 0}; }, componentWillMount: function() { a = this; }, render: function() { return
A{this.state.x}
; } }); var B = React.createClass({ componentWillMount: function() { a.setState({x: 1}); }, render: function() { return
; } }); ReactUpdates.batchedUpdates(function() { ReactTestUtils.renderIntoDocument( ); }); expect(a.state.x).toBe(1); expect(a.getDOMNode().textContent).toBe('A1'); }); it('calls componentWillReceiveProps setState callback properly', function() { var callbackCount = 0; var A = React.createClass({ getInitialState: function() { return {x: this.props.x}; }, componentWillReceiveProps: function(nextProps) { var newX = nextProps.x; this.setState({x: newX}, function() { // State should have updated by the time this callback gets called expect(this.state.x).toBe(newX); callbackCount++; }); }, render: function() { return
{this.state.x}
; } }); var container = document.createElement('div'); React.renderComponent(
, container); React.renderComponent(, container); expect(callbackCount).toBe(1); }); });", "pos": ["This throws . Maybe this can be simplified some more but this was the simplest repro I could make. Thanks for sending a repro case over.\nWow, it really was a bug. Narrowed it down a little, but it's still rediculously \"complex\". Big props to for repro! Anyway, just glancing at the code and from experience, I can safely assume that the issue is that receives multiple updates to the same node from . Which intuitively didn't make any sense at all to me, since always calls when it's done and is basically just recursive. However, when taking another peek at the code, I'm pretty sure that the issue is that (in this case) makes the invalid assumption that all updates belongs to the same root. When that is not the case, an to a component which itself updates another root will only once everything is done. The updates to the other root will NOT after each on that root because will always greater than 0. In practice this means that whenever updates another root, all DOM updates on that root will be batched one after the other (as opposed to batching component updates) which is a violation of assumptions in . It's also very inefficient. Intuitively it seems that what should happen is that all component updates within a call should be (but that is not for sure), exactly how this should be solved in practice I'm not 100% sure right now. But I'm 95% sure that this is what's happening, and the repro does have all the ingredients.\nSpeaking a bit to in chat, I feel like the issue is that and when called from within become asynchronous as opposed to synchronous as they usually are. Which leads to this issue, but also possibly a lot of other subtle issues.\nApparently is not at all to blame...\nNarrowed it down even further, apparently it breaks immediately on the first , the error just didn't show up until later unless prodded.", "I still don't feel any more enlightened on the issue though...\nYour latest two jsbins (4 & 6) throw different error for me (from in X ): And, if one removes Z from A , the same X throws , because then A render won't have any refs on that render so will be undefined... React docs warn that \"Never access refs inside of any component's render method - or while any component's render method is even running anywhere in the call stack.\", don't know if it's relevant here.\nYeah different error, but I'm sure the cause is the same. The issue is the span not actually ever being rendered, just that in the old repro it doesn't actually turn into an error until later.\nOk, so perhaps here's a reduced test case, see console: is being called twice in a row, and the first time the span is not there in DOM even though it has been rendered already. One culprit for this behavior may be that you are effectively calling setState on sibling component where setState would not be allowed on component itself (triggered via componentWillUpdate).\nHuh? It does end up being rendered in your test case, and there's no error?\nno I didn't want to throw the error so that you can see that the componentDidUpdate will be called double. The point is that first the span is not there and if one would try to access it (as in your ref.getDOMNode()) it would throw. See console for flow.\nis defined so it's an error regardless, and more than that, React expects the node to be there, but it isn't and throws an error. Even after it still isn't physically there in the DOM. So something is wrong. Unless I'm missing something.\nYes, there is definitely a problem there as you said, sorry for not being clear. I just wanted to reduce it so that there are no refs or forceUpdates which may bring other problems. One could throw the error in componentDidUpdate for clarity, as the innerHTML is definitely empty where it should not be. But it is interesting that it will be called right away again, and then the span will be there.", "But it throws:\nWas this fixed?\nWas clearing up old some old issues and it seemed like this was fixed, but apparently not.\nI've found this same problem. Here's a minimal failing example for React 0.12.2: ,output However, it appears that this is fixed in 0.13RC: ,output. Any ideas which commit fixed this? If there aren't tests which exercise this it might creep back in.\nSame here. Was perhaps related? I created a simple test case based on jsbin, which currently passes. Unfortunately I'm unable to run tests in anything besides master so can't really validate.\nAFAIK no longer exists as of React 0.13, so this issue should be irrelevant now."], "neg": []} {"query": "var instance; var Component = createReactClass({ displayName: 'MyComponent', mixins: [ { componentWillMount() { this.log('mixin.componentWillMount'); }, componentDidMount() { this.log('mixin.componentDidMount'); }, componentWillUpdate() { this.log('mixin.componentWillUpdate'); }, componentDidUpdate() { this.log('mixin.componentDidUpdate'); }, componentWillUnmount() { this.log('mixin.componentWillUnmount'); }, }, ], log(name) { ops.push(`${name}: ${this.isMounted()}`); },", "pos": ["Do you want to request a feature or report a bug? Bug What is the current behavior? Calling in in prior versions would return . Now it returns . I believe this was untested behavior before, but the new tests that were may check the wrong value: Changing this line to test for will exhibit the behavior. The fix would be to defer setting the flag to until after all mixins and the method were called on the component. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? and anything using is broken. Working correctly in 15.4.x with .\nI fixed this locally by splitting the IsMountedMixin into two: Then installing the Post after the spec has been mixed in: For the life of me I can't find the right repo to PR this against though.\nThis should be fixed with . Can you please verify?\nI don't see that version published yet.\nIt's not set to (still an RC) but it exists: Will turn into 15.6.0 tomorrow.\nAh indeed. It's probably our internal registry being slow. I'll try it out soon.\nConfirmed working correctly in .\nGreat. Thanks for sending the fix!"], "neg": []} {"query": "\"/.module-cache/\" ], \"testPathDirs\": [ \"/src\" \"/src\", \"/eslint-rules\" ], \"unmockedModulePathPatterns\": [ \"\"", "pos": ["using npm mocha is not necessarily at (thanks to hoisting). (eg it's actually at for me)\nWe've found out that it's possible to use eslint-tester with jest, so we should just do that."], "neg": []} {"query": "toggleParseHookNames(); }; const hookParsingFailed = parseHookNames && hookNames === null; let toggleTitle; if (hookParsingFailed) { toggleTitle = 'Hook parsing failed'; } else if (parseHookNames) { toggleTitle = 'Parsing hook names ...'; } else { toggleTitle = 'Parse hook names (may be slow)'; } const handleCopy = () => copy(serializeHooksForCopy(hooks)); if (hooks === null) {", "pos": ["The named hooks cache returns The first (mixed array of string and null) indicates an overall success, even if some names couldn't be inferred. The second indicates an error (e.g. couldn't locate or load source map). In the event of the 2nd response type, the UI currently does nothing (falls back to default) but we should show an error badge (maybe a disabled but red icon with a tooltip saying there was an error) since it's a confusing user experience to just do nothing."], "neg": []} {"query": "expect(summary).toEqual([]); }); it('should not fail on input change events', function() { var container = document.createElement('div'); var onChange = () => {}; var input = ReactDOM.render( , container ); expectNoWaste(() => { ReactTestUtils.Simulate.change(input); }); }); it('should print a table after calling printOperations', function() { var container = document.createElement('div'); var measurements = measure(() => {", "pos": ["Calling results in: (this is on a page internally at Facebook so I assume it's a fairly recent React version)\nAre you still experiencing this issue internally? If so, can you create an internal task with details and repro steps? Assign to the oncall, cc the React team. Our internal configuration is a bit different, and we don't want to discuss internal code/details/configurations on github. I'm going to close this out, and we can help you debug using internal tools if you're still running into problems.\nSmall note for anyone experiencing a similar error message who arrived here by Googling: I got bit by this because I updated and without updating at the same time.\nI'm getting this issue after upgrading to react 15.0.1. All my React packages (including perf) is 15.0.1. printExclusive() etc. works, but printWasted gives the exception shown above.\nAre you running before using it?\nYes. , and the rest of the Perf API works, for example , but not . I changed over to my 0.14.7 branch, and there everything works like it should, and I double checked that both ReactPerf and React was on 15.0.1. ! I can dig around a bit more if this isn't anything known.\nLet\u2019s reopen until we hear more.\nI had it working for a few minutes and then it started failing without me doing anything strange.\nThanks for the info, do you also have the same stack trace and error message as the first post?\nYes. I was exposing the object as . I tried again exposing it as and it's working again. Puzzling. I'm using the full 15.0.1 ecosystem, on Babel 6, Webpack and Webpack dev server, testing on Chrome.\nAny chance you have a public project where you can more or less consistently reproduce this?\nTechnically this means there was for which there was no . This code is super fragile so it\u2019s hard to pin it down without having a specific component hierarchy that happens to cause this.\nIf someone wants to spend some effort tracking it down, I would recommend: just before in . just before in . Then please share the relevant logs that correspond to the ID you see in the message.\nThanks Dan, I'll try setting up that to see if I can help.", "Unfortunately I cannot share my project right now because of client terms.\nYeah, I thought this might be the case. Thanks for taking the time to investigate.\nOK I the lines and I managed to also reproduce the error. . FYI, my app is a SPA, I captured this on a route where I have a long list of items that can be filtered by certain criteria and doing before filtering and after some of those items were removed because of the filtering.\nThank you, this is very helpful! I\u2019ll dig into it and see if I can repro this given the new info."], "neg": []} {"query": "export const REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; export const REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; export const REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;", "pos": ["It seems like react-is v16.6 no longer is compatible with React v16.3 - v16.5, in that React v16.3 - v16.5 will use , but 's export will instead be . It seems like the async mode symbol needs to remain the same in react-is 16.6+, and the function would need to check both the AsyncMode and ConcurrentMode symbols.\n(Note that this blocks full enzyme support of react v16.6)\nCan you explain more about the case in which it\u2019s breaking?\nsure - the enzyme react 16 adapter needs to maintain support for all versions of React 16. It provides a \"getDisplayNameOfNode\" function, which needs to be able to return the string in React 16.3-16.5 (for ), and the string in React 16.6+ (for ). It does this by comparing the to the or symbol exports from . In the 16.3-specific adapter, this isn't an issue, but it does have to lock the version of to (which is the breaking change part) - it should be able to keep working with react v16.3 and 16.anything. If v16.6+ had an symbol export that matched what React 16.3-16.5 did, then I think this wouldn't be a problem.\nIf react-is v16.6+ had an AsyncMode symbol export that matched what React 16.3-16.5 did, then I think this wouldn't be a problem. I think that sounds okay, we could do it. PR?\nSure, I'll try my hand at it!\nThis is our mistake because we should have prefixed isAsyncMode with unstable which the actual api was. Or not included it at all. We\u2019re treating unstable effectively as private and will break between minors. Are you ok with not supporting calls that are unstable_ in the future? Because we\u2019ll break them several times between releases and don\u2019t want to keep them all around in bundles.\nPrefix or not, renaming things is still going to break consumers. However, I understand react decides to accept this breakage in minor versions. Either way, the value of is that it abstracts over these kind of changes. \"Not including it at all\" would have meant I had to hardcode this stuff inside enzyme, which defeats the whole purpose of in the first place.", "In this case, the bundle size difference is negligible - when this is the case, it seems worth trying to keep back compat, even on things react has decided are effectively private.\nThe alternative is that we put it behind a feature flag and don\u2019t expose the featur at all. But then it\u2019s much harder for people to try it out for cases where breakages are ok. It\u2019s really hard for people in many environments to use alpha builds.\nI understand the dilemma. In this case, the functionality hasn't changed, and I'm not sure why it was renamed - iow i'm not sure how it helps people try it out to have the name change now, when it's still going to have to change again when it gets promoted to being stable. The tradeoffs seem to be somewhere between \"difficult for people to try it out\", \"cause breakage in some amount of downstream tooling\", or \"incur a tiny additional bundle cost to maintain back compat\". It's a tough call, and I'm not asking for a policy change - but in this case, the bundle size increase of seems pretty close to zero (i can't imagine it's more than a handful of bytes), and the benefit is that enzyme (and presumably other downstream tools) will be able to continue using without having to hardcode things."], "neg": []} {"query": "* React Core . General Purpose Event Plugin System */ var hasEventPageXY; var alreadyListeningTo = {}; var isMonitoringScrollValue = false; var reactTopListenersCounter = 0;", "pos": ["React adds a scroll listener that tracks and caches the scroll position (I assume for some undocumented internal purpose). Additionally, the scroll listener forces a synchronous layout (see screenshot). This seems wasteful, especially considering that the values tracked are never exposed in the API. What is the scroll listener used for? Can it be removed? !\nViewportMetrics is used to normalize pageX and pageY on mouse events: . Perhaps ironically, it was created to prevent synchronous layouts during mouse event handlers.\nI wish these values (as well as the event) were somehow exposed.\n:+1:\nBTW you can obviously have this if you use a Webpack-like bundler:\nWell, is only used for IE8 and possibly other very old browsers (), so we should be able to just disable it for all other browsers and everyone is happy right? (Could still be optimized slightly for IE8... if anyone cares) Also, That makes no sense at all to me, does not take an argument, yet we get the scroll position and provide it as an argument. Instead, gets the scroll position internally and uses that? So we call twice, but only use the result once (also, this should be broken for events inside iframes, for IE8). Also2, I'm pretty sure any browsers that supports touch, also supports . cc\nI agree that we shouldn't be tracking it in other browsers if we don't need it. I don't know if there's a way to predict whether we'll have .pageX and .pageY before mouse events actually come in.\n:)\nAnother idea being just let resize/scroll set a flag, when a mouse event is created, if the flag is set, update viewport metrics. That way we only update it when needed, but could potentially cause a reflow if there are other events before it (very unlikely though I imagine).\nThis issue causes React based longer lists unusable on mobile.\nIs there any progress on this issue? I\u2019m not sure if this is the root-cause for pages rendered with react scrolling extremely slow with firefox mobile on android (e.g. this react website ).\nIs that your site? If so, you can try commenting out the logic in refreshScrollValues to see if it makes a difference. If it does, I'm happy to prioritize and try to get it in.", "No, that is not my site, it is an example react & fluxible page (see: ), but we have exactly the same issues with scrolling on firefox mobile. I\u2019ve applied the changes in manually and it doesn\u2019t solves the problem, so this issue might be unrelated to my problem. I will investigate further. Thanks for considering to prioritize this. Much appreciated."], "neg": []} {"query": "var initialState = this.getInitialState ? this.getInitialState() : null; if (__DEV__) { // We allow auto-mocks to proceed as if they're returning null. if (typeof initialState === 'undefined' && if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience.", "pos": ["Introduction I found a bug on resolving default props when component props have property with HTMLAllCollection. React ignores value and uses default value (it should take that collection). isIE9OrLower (look at the end of topic) is simple function to test Internet Explorer in version 9 or lower. Simple use case: Chrome/Firefox/modern IE (yeah, i know....) returns HTMLAllColection (as ), but old IE returns true. HTMLAllCollection is weird collection: Source of bug and fix release: 0.14.7 file: line: 9149 code (bug): if (typeof props[propName] === 'undefined') { code (fix): if (props[propName] === undefined) { Btw, === undefined is faster than typeof === 'undefined' on Chrome and IE. Reproduction Open in Firefox / Chrome / IE10 or higher. Fiddle: Raw: Workaround Change to\nHaha, browsers suck. Want to submit a PR? It looks like we do that thing unnecessarily in a few places in the React codebase. Note that we do need to use typeof if the binding might not exist, so we need to look at each case individually to make sure the change is valid there.\nI went through the react repo configuration (build, tests execution). Fix didn't break anything, but so far I didn't find solution to make good test (phantomjs doesn't have property). (HTMLAllCollection) is probably the only exception to the typeof and is not a html standard. Any suggestions to the unit test for this fix/improvement?\nAs long as you tested it manually and it worked in IE, I think we can accept this change without a unit test.\nFixed in\nlol what even\nI can't reproduce being in IE 8 or IE 9 on Windows 7, either in standards or quirks mode. What am I missing?\nIE < 10 is fine. Problem occurs when using modern browser like Chrome, Firefox, IE = 10 or Edge. They returns . component prop as in Chrome. will compare your prop with default prop (which is ). on Chrome is so React treats it as missing value. Default prop () will be selected. the end, prop will be always set to on modern browser in this case.\nOh! Sorry I totally misread. Yes I can repro this."], "neg": []} {"query": "); }); it('should allow {__html: null}', function() { expect(function() { mountComponent({dangerouslySetInnerHTML: {__html: null} }); }).not.toThrow(); }); it(\"should warn about contentEditable and children\", function() { spyOn(console, 'error'); mountComponent({contentEditable: true, children: ''});", "pos": ["In following JSX fragment I should guarantee that will never be or : Otherwise throws an error although construction is correct: Should instead of check for ?\nSomeone else mentioned this being surprising to me too.\nI've been experiencing the same issues recently\nAs far as I understand it, the idea is that is basically the equivalent of a HTML-type. You're not meant to use it as , but as so that you cannot accidentally pass unsafe data. So should be or , in this model it does not make sense to have .\nThat doesn't mean that people won't write it as \u2013 doing so is even pretty reasonable if you're careful about naming your vars/props and do .\nThe simplest workaround is to coerce into an empty string with . +1 for having React do this internally.\nGot surprised by this today, upgrading from to . Was it a \"bug\" in (i.e. it shouldn't have accepted ), or is it a bug in ? Anyway, will use as suggested by just wanted to point out that it seemed to \"work\" in ."], "neg": []} {"query": "// Should be document order, not mount order (which would be purple, orange) expect(log).toEqual(['orangepurple', 'orange', 'purple']); }); it('does not warn for getDOMNode on ES6 classes', function() { var Foo = React.createClass({ render: function() { return
; } }); class Bar extends React.Component { render() { return
; } } spyOn(console, 'warn'); var foo = ReactTestUtils.renderIntoDocument(); expect(ReactTestUtils.isDOMComponent(foo)).toBe(false); var bar = ReactTestUtils.renderIntoDocument(); expect(ReactTestUtils.isDOMComponent(bar)).toBe(false); var div = ReactTestUtils.renderIntoDocument(
); expect(ReactTestUtils.isDOMComponent(div)).toBe(true); expect(console.warn.calls.length).toBe(0); }); });", "pos": ["TestUtils.isDOMComponent(...) uses deprecated Element.getDOMNode(), resulting in console warnings when running tests. In my case, running 175 unit tests results in 700+ such warnings, drowning the output of the tests.\nHow are what tests are you running?\nThe tests are standard unit tests for custom React components. For example, I have a Toggle component that dispatches an event with type '' when clicked.\nI'm also seeing the same issue testing under karma and mocha.\nit looks like you this TODO? Can we get this fixed? Happy to help, but not sure what the right heuristic is.\nThis is unfortunate. I don't quite know what the right heuristic should be for 0.13, but we're changing it for 0.14 anyway since refs on DOM component will just be regular DOM nodes so I think we'll just power through. :/\nMaybe we can do ?\nI was thinking that we can reuse string types for ART and React Native too. We wouldn't want a React Native node to hit this.\nmaybe then?\nIt is not an own property. (And will be deprecated anyway so not a great heuristic.)\nLets just move fast on the ref === real DOM node stuff instead of spending time figuring this out."], "neg": []} {"query": "ReactCache = require('react-cache'); Suspense = React.Suspense; container = document.createElement('div'); document.body.appendChild(container); TextResource = ReactCache.unstable_createResource(([text, ms = 0]) => { return new Promise((resolve, reject) =>", "pos": ["'); }); it('should not register event listeners', function() { var EventPluginHub = require('EventPluginHub'); var cb = jest.genMockFn();", "pos": ["Run this: Get this: Not sure if this is a bug but I thought and friends are gone in , no? Also when testing with an old project using - which has a much complex scenario, returned following causing a blank page: Just wondering is the behavior for server rendering changing in ? Thanks.\nis gone for client-side rendering, but still exists for server-side rendering. This is expected behavior. However, is NOT desired output. Can you provide an example component/render that generates this output?\nThis happens when a root composite component returns .\nI spent all day trying to trace the root cause of the issue and ended up confirmed it's a false alarm, it was caused by lib which returns a null root component while rendering on the server. I'm currently working on different approaches to implement universal apps on both server and client, will report back if I hit any other issues with v15.\nBut, to be clear, this is a valid bug in React.\nUpdate: just confirmed that is working fine with other apps in regard to server rendering once removed . One thing to note though I saw a lot of comments for text like this, just wondering is it necessary?\nRight, but the use case that mentioned clearly demonstrates the bug. It's necessary for tracking separating the text elements in order to apply updates/diffs.\nUnderstood, thanks for the explanation."], "neg": []} {"query": "}); var shallowRenderer = ReactTestUtils.createRenderer(); shallowRenderer.render(, {}); shallowRenderer.render(); shallowRenderer.unmount(); expect(componentWillUnmount).toBeCalled();", "pos": ["I am trying to render a component using the preliminary shadow renderer support in TestUtils. A simple reproducible test case of my issue is this When I run this in my Jest test, I get: It looks like this error is thrown whenever the component being rendered has . I thought perhaps the context was required (although I haven't had any problems omitting it in my actual app), but even when using I get the same exception.\nI think this is a known issue with shallow rendering. cc\nthanks for the report. Context isn't meant to be supported with shallow rendering (i.e., we haven't tested it), but it looks like you may be able to work around this problem by passing an object as the second argument to : it looks like an additional argument was to the shallow rendering API in . What was the thinking here? Can we default this to an empty object?\nThanks, the workaround works great. And I see you posted a fix as well so looking forward to that."], "neg": []} {"query": "); } function batchedUpdates(callback, param) { var NESTED_UPDATES = { initialize: function() { this.dirtyComponentsLength = dirtyComponents.length; }, close: function() { if (this.dirtyComponentsLength !== dirtyComponents.length) { // Additional updates were enqueued by componentDidUpdate handlers or // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run // these new updates so that if A's componentDidUpdate calls setState on // B, B will update before the callback A's updater provided when calling // setState. dirtyComponents.splice(0, this.dirtyComponentsLength); flushBatchedUpdates(); } else { dirtyComponents.length = 0; } } }; var UPDATE_QUEUEING = { initialize: function() { this.callbackQueue.reset(); }, close: function() { this.callbackQueue.notifyAll(); } }; var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; function ReactUpdatesFlushTransaction() { this.reinitializeTransaction(); this.dirtyComponentsLength = null; this.callbackQueue = CallbackQueue.getPooled(null); this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(); } mixInto(ReactUpdatesFlushTransaction, Transaction.Mixin); mixInto(ReactUpdatesFlushTransaction, { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; }, destructor: function() { this.dirtyComponentsLength = null; CallbackQueue.release(this.callbackQueue); this.callbackQueue = null; ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); this.reconcileTransaction = null; }, perform: function(method, scope, a) { // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` // with this transaction's wrappers around it. return Transaction.Mixin.perform.call( this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a ); } }); PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); function batchedUpdates(callback, a, b) { ensureInjected(); batchingStrategy.batchedUpdates(callback, param); batchingStrategy.batchedUpdates(callback, a, b); } /**", "pos": ["This throws . Maybe this can be simplified some more but this was the simplest repro I could make. Thanks for sending a repro case over.\nWow, it really was a bug. Narrowed it down a little, but it's still rediculously \"complex\". Big props to for repro! Anyway, just glancing at the code and from experience, I can safely assume that the issue is that receives multiple updates to the same node from . Which intuitively didn't make any sense at all to me, since always calls when it's done and is basically just recursive. However, when taking another peek at the code, I'm pretty sure that the issue is that (in this case) makes the invalid assumption that all updates belongs to the same root. When that is not the case, an to a component which itself updates another root will only once everything is done. The updates to the other root will NOT after each on that root because will always greater than 0. In practice this means that whenever updates another root, all DOM updates on that root will be batched one after the other (as opposed to batching component updates) which is a violation of assumptions in . It's also very inefficient. Intuitively it seems that what should happen is that all component updates within a call should be (but that is not for sure), exactly how this should be solved in practice I'm not 100% sure right now. But I'm 95% sure that this is what's happening, and the repro does have all the ingredients.\nSpeaking a bit to in chat, I feel like the issue is that and when called from within become asynchronous as opposed to synchronous as they usually are. Which leads to this issue, but also possibly a lot of other subtle issues.\nApparently is not at all to blame...\nNarrowed it down even further, apparently it breaks immediately on the first , the error just didn't show up until later unless prodded.", "I still don't feel any more enlightened on the issue though...\nYour latest two jsbins (4 & 6) throw different error for me (from in X ): And, if one removes Z from A , the same X throws , because then A render won't have any refs on that render so will be undefined... React docs warn that \"Never access refs inside of any component's render method - or while any component's render method is even running anywhere in the call stack.\", don't know if it's relevant here.\nYeah different error, but I'm sure the cause is the same. The issue is the span not actually ever being rendered, just that in the old repro it doesn't actually turn into an error until later.\nOk, so perhaps here's a reduced test case, see console: is being called twice in a row, and the first time the span is not there in DOM even though it has been rendered already. One culprit for this behavior may be that you are effectively calling setState on sibling component where setState would not be allowed on component itself (triggered via componentWillUpdate).\nHuh? It does end up being rendered in your test case, and there's no error?\nno I didn't want to throw the error so that you can see that the componentDidUpdate will be called double. The point is that first the span is not there and if one would try to access it (as in your ref.getDOMNode()) it would throw. See console for flow.\nis defined so it's an error regardless, and more than that, React expects the node to be there, but it isn't and throws an error. Even after it still isn't physically there in the DOM. So something is wrong. Unless I'm missing something.\nYes, there is definitely a problem there as you said, sorry for not being clear. I just wanted to reduce it so that there are no refs or forceUpdates which may bring other problems. One could throw the error in componentDidUpdate for clarity, as the innerHTML is definitely empty where it should not be. But it is interesting that it will be called right away again, and then the span will be there.", "But it throws:\nWas this fixed?\nWas clearing up old some old issues and it seemed like this was fixed, but apparently not.\nI've found this same problem. Here's a minimal failing example for React 0.12.2: ,output However, it appears that this is fixed in 0.13RC: ,output. Any ideas which commit fixed this? If there aren't tests which exercise this it might creep back in.\nSame here. Was perhaps related? I created a simple test case based on jsbin, which currently passes. Unfortunately I'm unable to run tests in anything besides master so can't really validate.\nAFAIK no longer exists as of React 0.13, so this issue should be irrelevant now."], "neg": []} {"query": "The examples in the React repository are declared a bit differently than a third-party renderer would be. In particular, the `HostConfig` object mentioned above is never explicitly declared, and instead is a *module* in our code. However, its exports correspond directly to properties on a `HostConfig` object you'd need to declare in your code: * [React ART](https://github.com/facebook/react/blob/main/packages/react-art/src/ReactART.js) and its [host config](https://github.com/facebook/react/blob/main/packages/react-art/src/ReactARTHostConfig.js) * [React DOM](https://github.com/facebook/react/blob/main/packages/react-dom/src/client/ReactDOM.js) and its [host config](https://github.com/facebook/react/blob/main/packages/react-dom/src/client/ReactDOMHostConfig.js) * [React DOM](https://github.com/facebook/react/blob/main/packages/react-dom/src/client/ReactDOM.js) and its [host config](https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/client/ReactDOMHostConfig.js) * [React Native](https://github.com/facebook/react/blob/main/packages/react-native-renderer/src/ReactNativeRenderer.js) and its [host config](https://github.com/facebook/react/blob/main/packages/react-native-renderer/src/ReactNativeHostConfig.js) If these links break please file an issue and we\u2019ll fix them. They intentionally link to the latest versions since the API is still evolving. If you have more questions please file an issue and we\u2019ll try to help!", "pos": [" ", "pos": ["Should be as simple as making sure we include the polyfills we document\nSomehow I assumed it was intentional that the polyfills weren't included, now I feel silly.\nEh, not really intentional, just never bothered to do it. Looking back it's a bit silly for us to say that we work in IE8 but not prove it.\nIt's ok guys, don't blame yourself for that IE8 story :) (this post is related to : !topic/reactjs/Z2jNf7za7cM) Meanwhile, I've just replied to Paul. Maybe you can help there because I'm stuck :+1: Thanks for your support and the work you've accomplished.\nHmm, it would appear this won't be possible so long as we use JSXTransform on the site. We could fix the NodeList -array issue, but we won't (and shouldn't try to) make changes to esprima to make it work (I think it's mostly using \"reserved\" words as keys. I guess we can turn this bug into \"include polyfills, make sure things works as well as possible, provide some warnings if using IE8 about the problem\"\nSo basically (tell me if I'm wrong) JSXTransform is not compatible with IE8.0 ? But ReactJS should be compatible, right ?\nCorrect. I just tested this myself with the zip I emailed to you - it's online for now at\nThanks zpao (you can remove it from your server if you wish I downloaded the srcs). I would recommend to add the non JSXTransformed example to git or the tutorial maybe ? Again thanks Paul and Spicyj for you help.\nThis should be easy now that has landed.\n8 is out with , so this should be even easier to jump into."], "neg": []} {"query": "maybeMessage: any, ...inputArgs: $ReadOnlyArray ): string { if (typeof maybeMessage !== 'string') { return [maybeMessage, ...inputArgs].join(' '); } const re = /(%?)(%([jds]))/g; const args = inputArgs.slice(); let formatted: string = maybeMessage; if (args.length) { formatted = formatted.replace(re, (match, escaped, ptn, flag) => { let arg = args.shift(); switch (flag) { case 's': arg += ''; break; case 'd': case 'i': arg = parseInt(arg, 10).toString(); break; case 'f': arg = parseFloat(arg).toString(); break; } if (!escaped) { return arg; } args.unshift(arg); return match; }); // Symbols cannot be concatenated with Strings. let formatted: string = typeof maybeMessage === 'symbol' ? maybeMessage.toString() : '' + maybeMessage; // If the first argument is a string, check for substitutions. if (typeof maybeMessage === 'string') { if (args.length) { const REGEXP = /(%?)(%([jds]))/g; formatted = formatted.replace(REGEXP, (match, escaped, ptn, flag) => { let arg = args.shift(); switch (flag) { case 's': arg += ''; break; case 'd': case 'i': arg = parseInt(arg, 10).toString(); break; case 'f': arg = parseFloat(arg).toString(); break; } if (!escaped) { return arg; } args.unshift(arg); return match; }); } } // arguments remain after formatting // Arguments that remain after formatting. if (args.length) { formatted += ' ' + args.join(' '); for (let i = 0; i < args.length; i++) { const arg = args[i]; // Symbols cannot be concatenated with Strings. formatted += ' ' + (typeof arg === 'symbol' ? arg.toString() : arg); } } // update escaped %% values // Update escaped %% values. formatted = formatted.replace(/%{2,2}/g, '%'); return '' + formatted;", "pos": ["This function will throw this error if one of the arguments is type of . The error is swallowed but it does interfere with debugging. When I run with the \"pause on caught exceptions\" I get trapped here all the time. Can we change into ??? Every time No response 13.2- TypeError: Cannot convert a Symbol value to a string No response No response No response"], "neg": []} {"query": "## Transferring with `...` in JSX > NOTE: > > In the example below, the `--harmony ` flag is required as this syntax is an experimental ES7 syntax. If using the in-browser JSX transformer, simply open your script with ` ", "pos": ["Should be as simple as making sure we include the polyfills we document\nSomehow I assumed it was intentional that the polyfills weren't included, now I feel silly.\nEh, not really intentional, just never bothered to do it. Looking back it's a bit silly for us to say that we work in IE8 but not prove it.\nIt's ok guys, don't blame yourself for that IE8 story :) (this post is related to : !topic/reactjs/Z2jNf7za7cM) Meanwhile, I've just replied to Paul. Maybe you can help there because I'm stuck :+1: Thanks for your support and the work you've accomplished.\nHmm, it would appear this won't be possible so long as we use JSXTransform on the site. We could fix the NodeList -array issue, but we won't (and shouldn't try to) make changes to esprima to make it work (I think it's mostly using \"reserved\" words as keys. I guess we can turn this bug into \"include polyfills, make sure things works as well as possible, provide some warnings if using IE8 about the problem\"\nSo basically (tell me if I'm wrong) JSXTransform is not compatible with IE8.0 ? But ReactJS should be compatible, right ?\nCorrect. I just tested this myself with the zip I emailed to you - it's online for now at\nThanks zpao (you can remove it from your server if you wish I downloaded the srcs). I would recommend to add the non JSXTransformed example to git or the tutorial maybe ? Again thanks Paul and Spicyj for you help.\nThis should be easy now that has landed.\n8 is out with , so this should be even easier to jump into."], "neg": []} {"query": "ReactTestUtils.renderIntoDocument(); expect(console.error.argsForCall.length).toBe(1); }); it('should refresh state on change', function() { var stub = ; stub = ReactTestUtils.renderIntoDocument(stub); var node = ReactDOM.findDOMNode(stub); ReactTestUtils.Simulate.change(node); expect(node.value).toBe('giraffe'); }); });", "pos": ["Case: ,js,output I have a with a value depending on the state. When I select the 'baz' item in the combobox, and don't do anything in the onChange handler, the combobox suddenly displays the first element (even though the state is still the same). So, the state of the combobox is inconsistent with the state of its 'value' property. This seems to happen in at least Chrome and Safari."], "neg": []} {"query": "var SyntheticEvent = require('SyntheticEvent'); var assign = require('Object.assign'); var emptyObject = require('emptyObject'); var findDOMNode = require('findDOMNode'); var topLevelTypes = EventConstants.topLevelTypes;", "pos": ["I am trying to render a component using the preliminary shadow renderer support in TestUtils. A simple reproducible test case of my issue is this When I run this in my Jest test, I get: It looks like this error is thrown whenever the component being rendered has . I thought perhaps the context was required (although I haven't had any problems omitting it in my actual app), but even when using I get the same exception.\nI think this is a known issue with shallow rendering. cc\nthanks for the report. Context isn't meant to be supported with shallow rendering (i.e., we haven't tested it), but it looks like you may be able to work around this problem by passing an object as the second argument to : it looks like an additional argument was to the shallow rendering API in . What was the thinking here? Can we default this to an empty object?\nThanks, the workaround works great. And I see you posted a fix as well so looking forward to that."], "neg": []} {"query": "const [prevValue, setValue] = updateState(value); updateEffect( () => { Scheduler.unstable_next(() => { const previousConfig = ReactCurrentBatchConfig.suspense; ReactCurrentBatchConfig.suspense = config === undefined ? null : config; try { setValue(value); } finally { ReactCurrentBatchConfig.suspense = previousConfig; } }); const previousConfig = ReactCurrentBatchConfig.suspense; ReactCurrentBatchConfig.suspense = config === undefined ? null : config; try { setValue(value); } finally { ReactCurrentBatchConfig.suspense = previousConfig; } }, [value, config], ); return prevValue; } function startTransition(setPending, config, callback) { const priorityLevel = getCurrentPriorityLevel(); runWithPriority( priorityLevel < UserBlockingPriority ? UserBlockingPriority : priorityLevel, () => { setPending(true); }, ); runWithPriority( priorityLevel > NormalPriority ? NormalPriority : priorityLevel, () => { const previousConfig = ReactCurrentBatchConfig.suspense; ReactCurrentBatchConfig.suspense = config === undefined ? null : config; try { setPending(false); callback(); } finally { ReactCurrentBatchConfig.suspense = previousConfig; } }, ); } function mountTransition( config: SuspenseConfig | void | null, ): [(() => void) => void, boolean] { const [isPending, setPending] = mountState(false); const startTransition = mountCallback( callback => { setPending(true); Scheduler.unstable_next(() => { const previousConfig = ReactCurrentBatchConfig.suspense; ReactCurrentBatchConfig.suspense = config === undefined ? null : config; try { setPending(false); callback(); } finally { ReactCurrentBatchConfig.suspense = previousConfig; } }); }, [config, isPending], ); return [startTransition, isPending]; const start = mountCallback(startTransition.bind(null, setPending, config), [ setPending, config, ]); return [start, isPending]; } function updateTransition( config: SuspenseConfig | void | null, ): [(() => void) => void, boolean] { const [isPending, setPending] = updateState(false); const startTransition = updateCallback( callback => { setPending(true); Scheduler.unstable_next(() => { const previousConfig = ReactCurrentBatchConfig.suspense; ReactCurrentBatchConfig.suspense = config === undefined ? null : config; try { setPending(false); callback(); } finally { ReactCurrentBatchConfig.suspense = previousConfig; } }); }, [config, isPending], ); return [startTransition, isPending]; const start = updateCallback(startTransition.bind(null, setPending, config), [ setPending, config, ]); return [start, isPending]; } function dispatchAction(", "pos": ["Do you want to request a feature or report a bug? Bug What is the current behavior? is never set to true when calling within , but it does work properly when within a . Here's the correct behavior (accomplished via ): ! Here's the incorrect behavior (via ): ! Note the difference is that the opacity never changes to 0.4 (which is determined based on the state). What is the expected behavior? I expect them to both behave the same (at least as far as the user can observe). Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? react react-dom\nI guess startTransition is never intended to be used in effects. I didn't expect it even works. Looking at the doc again, Hmm, it doesn't clearly say so.\nOk but the use cases is interesting.\nDo you think this is the same as\nYes, I believe that's the same issue.\nHello, I think I have a similar issue when using with . When returns a new value I would like to create a new resource. I tried to use for this, but I don't even have an idea where to put ...\nyou can see the isPending is if the is bigger than 5100 when calling in .\nI'm seeing the same behavior as - setting to a value of 5200 or higher causes to fire reliably in the original CodeSandbox:\nThat is a bug we need to fix regardless.\nFixed by . Updated Sandbox:"], "neg": []} {"query": "- [`createFragment`](create-fragment.html), to create a set of externally-keyed children. - [`update`](update.html), a helper function that makes dealing with immutable data in JavaScript easier. - [`PureRenderMixin`](pure-render-mixin.html), a performance booster under certain situations. - (DEPRECATED) [`classSet`](class-name-manipulation.html), for manipulating the DOM `class` string a bit more cleanly. The add-ons below are in the development (unminified) version of React only:", "pos": ["Now that we deprecated it, we should remove it before we ship 0.14. Would you like the honors"], "neg": []} {"query": "return { \"debug\": true, \"mocking\": true, \"commonerConfig\": grunt.config.data.pkg.commonerConfig, \"constants\": { \"__VERSION__\": grunt.config.data.pkg.version, \"__DEV__\": true", "pos": ["I'd rather do it , if you don't mind.\nI think we should do both. I think a forced clean should force clean all of the build artifacts (of which .module-cache is a part of).\ncan we distinguish between and ?\nIn what situation would you want to clean but not remove ?\nI'm actually not aware of any other use cases for so maybe this is fine. But it still means we need to tell people to do if they encounter problems that might be fixed by doing so, whereas gives us a way to get the same effect with no verbal communication.\nI'm going to do it. I think we should probably also do .\nClosed by ."], "neg": []} {"query": "* 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 };", "pos": ["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."], "neg": []} {"query": "var instantiateReactComponent = require('instantiateReactComponent'); var invariant = require('invariant'); var keyMirror = require('keyMirror'); var keyOf = require('keyOf'); var merge = require('merge'); var mixInto = require('mixInto'); var monitorCodeUse = require('monitorCodeUse');", "pos": ["Right now we don't do this consistently, so you could have behavior that varies depending on where you put the key in your class spec. That's not great. Here's an example: (using master) This outputs: I think we should consistently behave like CompB (component, then mixin methods) but disagrees. Any other opinions. Potentially interested (once we figure out which way we go)? This is relatively contained and testable but it does take you right into core.\nDoing mixins first is more intuitive to me because that's normally how people write the specs (in my experience, at least).\nHi, thanks for the mention. I'd like to take on this if nobody minds. I agree with that calling mixins first is more intuitive.\nGo for it! Let me know if you have any questions; I'm happy to help.\nOK great. I'll try to do it tomorrow.\nMention me if there's something else I can take. I liked that although this task had a small scope, it introduced me to the way actually works and how spec transforms into a component instance. It would be cool if I could take a few small tasks in other areas (rendering, batching) that introduce me to these areas."], "neg": []} {"query": "const requiredBackends = new Set(); function registerRenderer(renderer: ReactRenderer) { function registerRenderer(renderer: ReactRenderer, hook: DevToolsHook) { let version = renderer.reconcilerVersion || renderer.version; if (!hasAssignedBackend(version)) { version = COMPACT_VERSION_NAME; } requiredBackends.add(version); // Check if required backend is already activated, no need to require again if (!hook.backends.has(version)) { requiredBackends.add(version); } } function activateBackend(version: string, hook: DevToolsHook) {", "pos": ["the codepen linked above. sure to open the Debug View, so codepen doesn't add any additional iframes (). : Warning in the Console tab: . Error in the Components tab: . After dismissing the error, all components seem to be accounted for (you might need to adjust the \"Hide components where...\" option). In my actual application the error pops up for every change in the tree, making the devtools virtually unusable. Note: This only seems to happen if the iframe is some time after the initial React tree was mounted in the parent window. When I remove the so the iframe is synchronously, I no longer see any warnings. Related issues: Every time No response 27.7 (5/7/2023) in Google Chrome Version 112.0.5615.165 (Official Build) (64-bit) Cannot add node \"3\" because a node with that id is already in the Store. No response No response\nHey thanks for reporting this. Can confirm this issue, but I am getting different error on my side and only when refreshing the page. Extension works as expected for me when I open the page for the first time. I will put up a fix for this.\ncan you please also validate this on your side? You can download a build from our CircleCI pipeline here - Chrome extension should be in archive, you can then install it via dialog in\nYes! I'm no longer seeing the warning/errors when I use the build you linked. Thanks for the fix :)\nGreat, thanks for helping resolving this. This will be included in v4.27.8 release, which I will publish this week."], "neg": []} {"query": "} } function clearDirtyComponents() { dirtyComponents.length = 0; } function flushBatchedUpdatesOnce(transaction) { // Run these in separate functions so the JIT can optimize try { runBatchedUpdates(transaction); } finally { clearDirtyComponents(); } } var flushBatchedUpdates = ReactPerf.measure( 'ReactUpdates', 'flushBatchedUpdates', function() { // flushBatchedUpdatesOnce will clear the dirtyComponents array, but // mount-ready handlers (i.e., componentDidMount/Update) may enqueue more // state updates which we should apply immediately // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents // array and perform any updates enqueued by mount-ready handlers (i.e., // componentDidUpdate) but we need to check here too in order to catch // updates enqueued by setState callbacks. while (dirtyComponents.length) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); transaction.perform(flushBatchedUpdatesOnce, null, transaction); ReactUpdates.ReactReconcileTransaction.release(transaction); var transaction = ReactUpdatesFlushTransaction.getPooled(); transaction.perform(runBatchedUpdates, null, transaction); ReactUpdatesFlushTransaction.release(transaction); } } );", "pos": ["This throws . Maybe this can be simplified some more but this was the simplest repro I could make. Thanks for sending a repro case over.\nWow, it really was a bug. Narrowed it down a little, but it's still rediculously \"complex\". Big props to for repro! Anyway, just glancing at the code and from experience, I can safely assume that the issue is that receives multiple updates to the same node from . Which intuitively didn't make any sense at all to me, since always calls when it's done and is basically just recursive. However, when taking another peek at the code, I'm pretty sure that the issue is that (in this case) makes the invalid assumption that all updates belongs to the same root. When that is not the case, an to a component which itself updates another root will only once everything is done. The updates to the other root will NOT after each on that root because will always greater than 0. In practice this means that whenever updates another root, all DOM updates on that root will be batched one after the other (as opposed to batching component updates) which is a violation of assumptions in . It's also very inefficient. Intuitively it seems that what should happen is that all component updates within a call should be (but that is not for sure), exactly how this should be solved in practice I'm not 100% sure right now. But I'm 95% sure that this is what's happening, and the repro does have all the ingredients.\nSpeaking a bit to in chat, I feel like the issue is that and when called from within become asynchronous as opposed to synchronous as they usually are. Which leads to this issue, but also possibly a lot of other subtle issues.\nApparently is not at all to blame...\nNarrowed it down even further, apparently it breaks immediately on the first , the error just didn't show up until later unless prodded.", "I still don't feel any more enlightened on the issue though...\nYour latest two jsbins (4 & 6) throw different error for me (from in X ): And, if one removes Z from A , the same X throws , because then A render won't have any refs on that render so will be undefined... React docs warn that \"Never access refs inside of any component's render method - or while any component's render method is even running anywhere in the call stack.\", don't know if it's relevant here.\nYeah different error, but I'm sure the cause is the same. The issue is the span not actually ever being rendered, just that in the old repro it doesn't actually turn into an error until later.\nOk, so perhaps here's a reduced test case, see console: is being called twice in a row, and the first time the span is not there in DOM even though it has been rendered already. One culprit for this behavior may be that you are effectively calling setState on sibling component where setState would not be allowed on component itself (triggered via componentWillUpdate).\nHuh? It does end up being rendered in your test case, and there's no error?\nno I didn't want to throw the error so that you can see that the componentDidUpdate will be called double. The point is that first the span is not there and if one would try to access it (as in your ref.getDOMNode()) it would throw. See console for flow.\nis defined so it's an error regardless, and more than that, React expects the node to be there, but it isn't and throws an error. Even after it still isn't physically there in the DOM. So something is wrong. Unless I'm missing something.\nYes, there is definitely a problem there as you said, sorry for not being clear. I just wanted to reduce it so that there are no refs or forceUpdates which may bring other problems. One could throw the error in componentDidUpdate for clarity, as the innerHTML is definitely empty where it should not be. But it is interesting that it will be called right away again, and then the span will be there.", "But it throws:\nWas this fixed?\nWas clearing up old some old issues and it seemed like this was fixed, but apparently not.\nI've found this same problem. Here's a minimal failing example for React 0.12.2: ,output However, it appears that this is fixed in 0.13RC: ,output. Any ideas which commit fixed this? If there aren't tests which exercise this it might creep back in.\nSame here. Was perhaps related? I created a simple test case based on jsbin, which currently passes. Unfortunately I'm unable to run tests in anything besides master so can't really validate.\nAFAIK no longer exists as of React 0.13, so this issue should be irrelevant now."], "neg": []} {"query": "expect(childEnterCalls).toBe(1); expect(parentEnterCalls).toBe(0); }); // Test for https://github.com/facebook/react/issues/16763. it('should call mouseEnter once from sibling rendered inside a rendered component', done => { const mockFn = jest.fn(); class Parent extends React.Component { constructor(props) { super(props); this.parentEl = React.createRef(); } componentDidMount() { ReactDOM.render(, this.parentEl.current); } render() { return
; } } class MouseEnterDetect extends React.Component { constructor(props) { super(props); this.firstEl = React.createRef(); this.siblingEl = React.createRef(); } componentDidMount() { this.siblingEl.current.dispatchEvent( new MouseEvent('mouseout', { bubbles: true, cancelable: true, relatedTarget: this.firstEl.current, }), ); expect(mockFn.mock.calls.length).toBe(1); done(); } render() { return (
); } } ReactDOM.render(, container); }); });", "pos": ["Do you want to request a feature or report a bug? I want to report a bug. What is the current behavior? Event handlers on elements are fired twice, when hovering from one element onto the next. 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? Event handlers should only fire once. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? React 16.8.4 ReactDOM 16.8.4 Chrome 76.0.3809.132 Firefox 69.0 (64-Bit) Edge 44..267.0\nAfter testing it again and again, I found how to reproduce it: Step 1, render a new component inside a rendered component; Step 2, inside the new component, mouse enter a node from its sibling. Current result: onMouseEnter is called more than once. Demo: We may change the issue title because it's not related with . I've made a test and fixture for this: Hope the information can be helpful. I still have no idea how to fix it. If there's no one working on this, I would like to pick this up. There's a similar issue Do you have any advice?\nGo for it,\nLet's close this? I see the fix was merged in ."], "neg": []} {"query": "// Check that the version we're exporting is the same one we expect in the // package. This is not an ideal way to do this, but makes sure that we keep // them in sync. var reactVersionExp = /bReact.versions*=s*['\"]([^'\"]+)['\"];/; grunt.registerTask('version-check', function() { var version = require('./build/modules/React').version; var version = reactVersionExp.exec( grunt.file.read('./build/modules/React.js') )[1]; var expectedVersion = grunt.config.data.pkg.version; if (version !== expectedVersion) { grunt.log.error('Versions do not match. Expected %s, saw %s', expectedVersion, version);", "pos": ["I am having an issue with text based inputs in React 0.14.3 and React DOM 0.14.3. When the event is fired for an input, the input will be deselected. Here is what this looks like in the UI: ! Here is an example of my components. There is a top-level component, which describes the fields on the form. This component also holds the state of the form and is the only component that extends . For each field in the form, there is a child component\u2014which each has a and child. The form also has one component, which, when clicked, will fire an function with the state of the form. With the exception of , these components are all stateless functional components. The components are controlled. They get their value from the top level form component. The state is properly updated in this top level after the event is fired\u2014as you would expect things to typically work with a controlled form. This state is then passed down via props to the input. I've been trying to figure out what could possibly be the cause of this weird deselection issue, but haven't made any progress... any ideas? Thanks.\nThis causes it: On every render the is a different random value. When the key is different, then React will not reuse the old component. So you lose focus because the input got replaced.\nAh, right, that would make sense. Bad mistake! Thanks.\nas a key is definitely a bad idea\nHaha, yes. I have long sense moved away from this solution."], "neg": []} {"query": "#### Events React attaches event handlers to components using a camelCase naming convention. We attach an onKeyUp handler to the text field, check if the user has entered text and pressed the enter key and then clear the form fields. React attaches event handlers to components using a camelCase naming convention. We attach an `onSubmit` handler to the form that clears the form fields when the form is submitted with valid input. We always return `false` from the event handler to prevent the browser's default action of submitting the form. (If you prefer, you can instead take the event as an argument and call `preventDefault()` on it – read more about [event handling](event-handling.html).) `React.autoBind()` is a simple way to ensure that a method is always bound to its component. Inside the method, `this` will be bound to the component instance.", "pos": ["Do you want to request a feature or report a bug? bug What is the current behavior? When using the latest Dev tools (v4.0.5) on my project, when I inspect react-redux elements that use connect() devtools crashes. I can't map from my crash to the actual source but the code is react devtools: up one level of stack is react: and up one level is react-redux: () 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: I'll have to try and make a small repro, but I hope there's something obvious given the info above. It's not clear to me if react-redux is doing something or if its devtools. This behavior existed in v3 and i was hoping it'd get magically fixed with v4 but it remains. What is the expected behavior? Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? This is in an electron app w/ react-redux v7.1.0 and react v16.8.3 (have to use this due to the version of react native i'm on)\nUnfortunately this is a bug with React that was fixed via PR and released with v16.8.4. Thank you for the detailed bug report though! Originally reported here:"], "neg": []} {"query": " 'use strict'; var grunt = require('grunt'); module.exports = function() { var done = this.async(); grunt.util.spawn({ cmd: 'node_modules/eslint-tester/node_modules/mocha/bin/mocha', args: ['eslint-rules/__tests__'], opts: {stdio: 'inherit'}, // allows colors to passthrough }, function(err, result, code) { if (err) { grunt.log.error('Custom linter rules are broken'); } else { grunt.log.ok('Custom linter rules are okay'); } done(code === 0); }); }; ", "pos": ["using npm mocha is not necessarily at (thanks to hoisting). (eg it's actually at for me)\nWe've found out that it's possible to use eslint-tester with jest, so we should just do that."], "neg": []} {"query": "}); it('accepts custom comparison function', async () => { const {Suspense} = React; function Counter({count}) { return ; }", "pos": ["", "pos": ["I am having an issue with text based inputs in React 0.14.3 and React DOM 0.14.3. When the event is fired for an input, the input will be deselected. Here is what this looks like in the UI: ! Here is an example of my components. There is a top-level component, which describes the fields on the form. This component also holds the state of the form and is the only component that extends . For each field in the form, there is a child component\u2014which each has a and child. The form also has one component, which, when clicked, will fire an function with the state of the form. With the exception of , these components are all stateless functional components. The components are controlled. They get their value from the top level form component. The state is properly updated in this top level after the event is fired\u2014as you would expect things to typically work with a controlled form. This state is then passed down via props to the input. I've been trying to figure out what could possibly be the cause of this weird deselection issue, but haven't made any progress... any ideas? Thanks.\nThis causes it: On every render the is a different random value. When the key is different, then React will not reuse the old component. So you lose focus because the input got replaced.\nAh, right, that would make sense. Bad mistake! Thanks.\nas a key is definitely a bad idea\nHaha, yes. I have long sense moved away from this solution."], "neg": []} {"query": "description: How to build advanced composite components. layout: docs prev: event-handling.html next: api.html next: mixins.html --- Composite components extend a `ReactCompositeComponent` base class that provides", "pos": ["There was another issue tracking this , but it looks like it got merged into an issue that was already closed so it never got fixed.\nThere's also .\nSVG images are an important part of my current project - is there anything I could do to help push this issue through?\nis a newer PR without the merge conflicts of\nClosed with"], "neg": []} {"query": "safeUnmount(); node.innerHTML = nodeWaitingToConnectHTML; disconnectedCallback(); } function onError({code, message}) {", "pos": ["Any client that connects to the standalone DevTools While using the standalone DevTools app: a client to the DevTools that client and you should be redirected to the introduction page The event listeners are not re-attached to the splash page elements after the client disconnects. The prev: advanced-components.html prev: mixins.html --- ## React", "pos": ["There was another issue tracking this , but it looks like it got merged into an issue that was already closed so it never got fixed.\nThere's also .\nSVG images are an important part of my current project - is there anything I could do to help push this issue through?\nis a newer PR without the merge conflicts of\nClosed with"], "neg": []} {"query": "}); function filterPrivateKeys(name) { // TODO: Figure out how to forward priority levels. return !name.startsWith('_') && !name.endsWith('Priority'); // Be very careful adding things to this whitelist! // It's easy to introduce bugs by doing it: // https://github.com/facebook/react/issues/14904 switch (name) { case '__interactionsRef': case '__subscriberRef': // Don't forward these. (TODO: why?) return false; default: return true; } } function validateForwardedAPIs(api, forwardedAPIs) {", "pos": [" ", "pos": ["Sometimes it's helpful for to have a playground for grokking React's features, and I like to use the live editor on the docs site to sketch out ideas and see how my code is called by the library. It'd be a huge help if the site's React source was served unminified so it's more apparent what's going on under the covers.\nI think this would be helpful:\nI think I'd be okay with this. Want to send a PR?"], "neg": []} {"query": "icon: null, id: MUST_USE_PROPERTY, inputMode: MUST_USE_ATTRIBUTE, integrity: null, is: MUST_USE_ATTRIBUTE, keyParams: MUST_USE_ATTRIBUTE, keyType: MUST_USE_ATTRIBUTE,", "pos": ["defines the \"integrity\" attribute. This attribute is not defined in HTMLDOMPropertyConfig so it is not included in HTML rendered on a server.\n+1 here. Modern browsers have supported this feature. Bootstrap tell me to use the following from CDN: Here is the MDN introduction:\ncc Contrary to popular belief, we do get these fairly frequently. Related to\nRelated in that there should be a good way of replacing whitelisting attributes, but it's not a custom attribute in the same sense as .\nYea \"related\", the underlying goal of that issue is to really get of the whitelist as much as possible, entirely would be good. I don't know that we called that out explicitly but they're mostly the same problem.\nYeah, my comment was directed at a conversation we had at our last team meeting when figuring out our priorities for the remainder of the year. Basically, there are a whole ton of attributes that we keep adding one-at-a-time, and I was/am pushing for us to solve and wipe them all out (past present and future) with a single swipe. But is a slightly non-trivial change with several dependencies and was thus demoted off the prioirty list :P."], "neg": []} {"query": "componentDidUpdate(object prevProps, object prevState) ``` Invoked immediately after updating occurs. This method is not called for the initial render. Invoked immediately after the component's updates are flushed to the DOM. This method is not called for the initial render. Use this as an opportunity to operate on the DOM when the component has been updated.", "pos": ["is unclear on when it is called with regards to the function. The docs state that it's \"Invoked immediately after updating occurs\" but it is unclear what is meant with updating in this case: it can refer to either the component as a whole updating (meaning post-render), or it can refer to setState() having been processed (which might mean pre-render). It would be good to explicitly state when this function fires in its documentation (even if somewhere else on the site this is described in text or graphic form already).\nI think this part makes it clear it happens after DOM is updated (post-render): However, overall I agree more descriptive (visual?) lifecycle explanation would be welcome.\nThat's not clear enough, though. React does a good job making sure you normally don't work on the DOM, so in this case I really need explicit text that says \"Use this as an opportunity to operate on the DOM after has finished\" - without that, it still entirely possible that it's offering a way to mess with the DOM before updates from subsequent render calls are worked in.\nThis wouldn't be entirely correct though. doesn't do anything per se, it just builds the virtual DOM tree.\ncomponentDidUpdate (and componentDidMount) is always called after the DOM has been updated \u2013 we can update the docs. Want to send a pull request?\nI'll have to read through your CLA carefully before I can file any PRs. In the mean time, any clarification you deem addresses this issue is fine by me.\nThe fact that it lets you operate on the updated DOM implies that it's post-render.\nsure, but I'd love to know you get that from the actual words used in the text, rather than from the text you read paired with your knowledge of React. In this case, three people went \"it's after the DOM updates\", so: sweet! Let's change the text from to and now it's no longer implied, now it's explicit, and new users don't scratch their head going \"what do they mean with updated? The tutorials mostly talk about updating in the sense of the state and props changing, but the text also talks about working on the DOM... this isn't clear enough\".\nlooks like PR material to me :) :+1:\nindeed, and I'm not filing one until I've read that CLA.", "I have issues with CLAs, which is why I'm filing this as an issue instead, and hopefully other people working on the code find opening the docs file on github, hitting \"edit\", and dropping that in, not too much work.\nI saw that this had been closed but it appears that the documentation remains unchanged. PR seems to have been merged but I'm not sure what ever became of that since it was over 3 years ago. Perhaps the language was reverted to its original form? I think the most important takeaway from original post is that documentation should always be as explicit as possible. The fact that two people from the React team responded by saying things along the lines of \"The fact that it lets you operate on the updated DOM implies that it's post-render\" highlights the problem. Nothing in documentation\u2014especially for such a widely used library\u2014should ever be implied because it lends to assuming that the reader has the same knowledge and understanding of the code as the people who wrote it.\nTo chime in: is componentDidUpdate called regardless of whether there are DOM changes? In the case when render runs And there is no change between the DOM and virtual DOM, does componentDidUpdate still fire? Sorry if this should be obvious.\nI'd like to know this as well. In my case, I change state, render is called, my component and it's child component both invoke their own render, but the parent's componentDidUpdate() is never fired. So, does this only file if the real DOM actually changed, or does it fire post-render, whether or not the real dom changed? FYI: my real dom did change, but the method was never called! Inquiring minds want to know!!\nAs pointed out, the clarification in the docs seems to have been reverted and this issue should be re-opened\nIf there is an issue with documentation, please file it in the documentation repository: Then we or somebody else can address it. We're not reading closed issues (it's hard enough to keep up with open ones!) so your feedback is unfortunately going into the void. Thank you!"], "neg": []} {"query": "const beforeState = this._newState; if (typeof this._instance.componentWillMount === 'function') { if (__DEV__) { // Don't warn about react-lifecycles-compat polyfilled components if ( warnAboutDeprecatedLifecycles && this._instance.componentWillMount.__suppressDeprecationWarning !== true ) { const componentName = getName(element.type, this._instance); if (!didWarnAboutLegacyWillMount[componentName]) { lowPriorityWarning( false, '%s: componentWillMount() is deprecated and will be ' + 'removed in the next major version. Read about the motivations ' + 'behind this change: ' + 'https://fb.me/react-async-component-lifecycle-hooks' + 'nn' + 'As a temporary workaround, you can rename to ' + 'UNSAFE_componentWillMount instead.', componentName, ); didWarnAboutLegacyWillMount[componentName] = true; } } } // In order to support react-lifecycles-compat polyfilled components, // Unsafe lifecycles should not be invoked for any component with the new gDSFP. if (typeof element.type.getDerivedStateFromProps !== 'function') {", "pos": ["For consideration. These warnings are already covered by renderers based on react-reconciler. Maybe we don't gain that much by mirroring them in the shallow renderer? Maybe it's not worth the complexity? Particularly with more complicated warnings like the ones being for and ."], "neg": []} {"query": "topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { nativeEvent, nativeEventTarget) { var getTargetIDFunc, handleEventFunc; if (shouldUseChangeEvent(topLevelTarget)) {", "pos": ["I tried updating from to . Something has changed in between these releases that is making it so that in onChange's synthetic event is undefined.\nThis appears to be related to a bug in . does not accept the argument and does not pass it on to . However that's not the only fix needed, also needs to pass something in place of the that expects. Also it seems has the same issue with being passed. I tried fixing this myself. However I have issues with the test setup and/or the test utils seem incapable of triggering from .\nYes I can confirm I have this issue too! This unfortunately makes the beta unusable in my app. The is null while the native event has a target\nSame issue. The workaround is using instead of . But that's kinda wrong :(\nSame here, but you can use for now.\nExcuse me. I'm a beginners of React. Can I ask a question? Why can I use \"jsx -watch src/build\" to translate \"\" file to plain JavaScrip?\nIn fact, I can't see any result after do all steps\nI don't know, but this is not the place for asking such questions. Ask this on Stackoverflow or IRC / Slack channels maybe\nThank you for your answer."], "neg": []} {"query": "* components with the class name matching `className`. * @return {array} an array of all the matches. */ scryRenderedDOMComponentsWithClass: function(root, className) { scryRenderedDOMComponentsWithClass: function(root, classNames) { if (!Array.isArray(classNames)) { classNames = classNames.split(/s+/); } return ReactTestUtils.findAllInRenderedTree(root, function(inst) { if (ReactTestUtils.isDOMComponent(inst)) { var instClassName = ReactDOM.findDOMNode(inst).className; return ( instClassName && (('' + instClassName).split(/s+/)).indexOf(className) !== -1 ); var classList = ReactDOM.findDOMNode(inst).className.split(/s+/); return classNames.every(function(className) { return classList.indexOf(className) !== -1; }); } return false; });", "pos": ["The function isn't quite working for me anymore after upgrading from 0.14-rc1 and 0.14. The error stack looks something like this:\nCan you post a minimal repro case please?\nThe minimal repro for me is this: If I use an element -- I get the error reported above. If I use a element -- there is no error. I tried dropping this as a Jest test in the React source code -- but it passed. However, running this exact same test in my local project -- it fails. I've confirmed that all React libs are 0.14. Could there be some kind of build process that's causing the issue? The line that fails is this when is the element.\nSounds like what mentioned here:\nIndeed. Looks like this is the same issue. I hope you can push that out fix in 0.14.1 soon as this is a blocking issue for my team for upgrading to 0.14. Thanks for the fast response.\nWe'll try. In the meantime, you could copy the definition from here since it doesn't rely on any React internals:"], "neg": []} {"query": " /** * Copyright 2014 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the \"License\"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an \"AS IS\" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule camelizeStyleName * @typechecks */ \"use strict\"; var camelize = require('camelize'); var msPattern = /^-ms-/; /** * Camelcases a hyphenated CSS property name, for example: * * > camelizeStyleName('background-color') * < \"backgroundColor\" * > camelizeStyleName('-moz-transition') * < \"MozTransition\" * > camelizeStyleName('-ms-transition') * < \"msTransition\" * * As Andi Smith suggests * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix * is converted to lowercase `ms`. * * @param {string} string * @return {string} */ function camelizeStyleName(string) { return camelize(string.replace(msPattern, 'ms-')); } module.exports = camelizeStyleName; ", "pos": ["We happen to \"support\" hyphenated keys to the style object on initial render (because we attempt to hyphenate camelcased keys) but those styles will never be updated on subsequent renders because we never attempt to unhyphenate. So we should warn when we see a hyphenated style.\nSome browsers support assigning with hyphenated keys, but probably not all do.\nAFAIK only Webkit does. (And I guess by association, Blink)\nPerhaps another one for you!\nOK\nSorry for the long delay, been busy. I'll try to do this today.\nNo problem, whenever you have time.\nCurious: why do we not want to hyphenate names on subsequent updates, and instead show a warning? Because there should be \u201cone way to do that\u201d?\nYes, this matches our existing practice of requiring camel-cased attributes in general, which makes it easier to make warpper components that modify props in some way because you only need to look in one place to find the original value. In addition, you don't need to worry about what happens if someone were to specify both and in the same style block. (One last advantage: if the warnings happen only in the dev version, then there's no runtime cost in the production build.)\nDo you think it's worth adding for the sake of providing a suggestive warning? (e.g. )\nThere you go! I also updated the docs about prefix, since it's not clear right now.\nA warning would be very helpful, this just sucked up a lot of my time. If anyone is interested, chrome seems to handle hyphenated CSS props OK but FF doesn't"], "neg": []} {"query": "var adler32 = require('adler32'); var TAG_END = //?>/; var COMMENT_START = /^