Commit Graph

7966 Commits

Author SHA1 Message Date
Dan Abramov bd23aa2712 Dedupe warnings about refs on functional components (#8739)
* Verify that functional component ref warning is deduplicated

It's not a big problem for string refs because the ref stays the same and the warning code path runs once per mount.

However, it is super annoying for functional refs since they're often written as arrows, and thus the warning fires for every render.

Both tests are currently failing since we're mounting twice, so even the string ref case prints warnings twice.

* Extract the warning condition to the top level

We don't want to run getStackAddendumByID() unless we actually know we're going to print the warning.

This doesn't affect correctness. Just a performance fix.

* Deduplicate warnings about refs on functional components

This fixes the duplicate warnings and adds an additional test for corner cases.

Our goal is to print one warning per one offending call site, when possible.

We try to use the element source for deduplication first because it gives us the exact JSX call site location.

If the element source is not available, we try to use the owner name for deduplication.

If even owner name is unavailable, we try to use the functional component unique identifier for deduplication so that at least the warning is seen once per mounted component.
2017-01-10 09:54:48 -08:00
Brian Vaughn 540ea9e2fe Replaced chalk.color.red with chalk.red 2017-01-10 08:45:56 -08:00
Dmitry Zhuravlev-Nevsky 280bcfa9f5 Fix single vs plural (#8738)
Maybe it's not very important, just misprint fix
2017-01-10 08:00:16 -08:00
Spen Taylor c3ce14a373 [Docs] Replace 'mix in' in PureComponent notes (#8730)
* [Docs] Replace 'mix in' in PureComponent notes

* Style nit
2017-01-10 06:02:22 -08:00
Dan Abramov 7e47c1aa4a Bump react-noop-renderer version to fix CI 2017-01-10 13:41:31 +00:00
Dmitry Zhuravlev-Nevsky 65bf19029d Swap components (#8735)
It's better to delare component before using.
2017-01-10 02:48:53 -08:00
Andrew Clark 00be2e437f Merge pull request #8728 from acdlite/fibernocallbacklist
[Fiber] Remove callbackList field from Fiber
2017-01-10 00:21:42 -08:00
Andrew Clark 288a4c4d6d Reset invalid UpdateQueue fields when cloning from current
Similar to what cloneFiber does. No change in behavior, but it's more
consistent this way.
2017-01-09 17:14:09 -08:00
Andrew Clark d4e971a266 Remove callbackList field from Fiber
Moves it to UpdateQueue instead so that we don't waste memory for
components that don't have update queues.
2017-01-09 17:10:10 -08:00
Brian Vaughn 378ef5e730 16.0.0-alpha.0 2017-01-09 16:45:56 -08:00
Brian Vaughn 24b8ba7340 Merge pull request #8723 from bvaughn/improve-unmasked-context-caching
Improve unmasked context caching
2017-01-09 15:33:20 -08:00
Andrew Clark f1a49e8d6e Merge pull request #8710 from acdlite/fiberscheduleupdateoptimization
[Fiber] Stop bubbling priority on equal priority
2017-01-09 15:24:25 -08:00
Brandon Dail a1dd107d7a Merge pull request #8589 from nhunzaker/browser-testing
Add basic testing page for browser quicks
2017-01-09 17:22:17 -06:00
Dustan Kasten 90294ead4c Warn for callback refs on functional components (Stack + Fiber) (#8635)
* Fiber: warn for refs on SFCs

* Stateless refs: update warning to use component stack

* Warn for function refs (stack and fiber)

* Add owner reference to ref warnings

* Centralize stack ref warnings in ReactRef.attachRef

* Fiber stateless comp ref warning should only do work when necessary

* ReactDebugCurrentFiber maybe FunctionalComponents should act this way instead

* (chore) scripts/fiber/record-tests

* Add component._compositeType to ReactInstance Flow definition

* Don't handle 'stack inside fiber' case in the warning

We don't have a test for it. It's easy to mess it up and print the wrong thing so instead of verifying it I'll just remove this bit.

* Revert the change to getCurrentFiberOwnerName

This happened to work, but it is just a coincidence. This change didn’t really match what the function was supposed to be doing.

I’m not sure what the correct fix would be yet so this commit breaks tests.

* Add component indirection to the tests using owner name

This passes in Stack. It helps ensure we supply the correct owner name.

* Invalid type invariant should read owner from element

This brings the Fiber behavior in line with how Stack does it. The Fiber test was passing accidentally but broke down in more complicated cases (such as when we have an <Indirection> between the owner and the failing element).

Now we can also remove the weird cases from getCurrentFiberOwnerName() that didn't really make sense but helped get the (incomplete) tests pass in the past.

* Fiber should throw on a string ref inside functional component
2017-01-09 15:09:18 -08:00
Brandon Dail 2dbff6e10c Updating paths in packaging fixtures README 2017-01-09 16:06:08 -06:00
Brandon Dail 2f8a3e5100 Use absolute paths for resolve.root in webpack packaging fixtures
Webpack requires absolute paths here
2017-01-09 15:59:47 -06:00
Brandon Dail 429da399e9 Move build fixtures to fixtures/packaging, updated paths 2017-01-09 15:55:25 -06:00
Brian Vaughn e5a7b75846 Improve unmasked context caching
Only store cached masked/unmasked contexts on context consumers. Move all references to __reactInternal* cached attributes inside of ReactFiberContext.
2017-01-09 13:51:03 -08:00
Richie Thomas b2cc91e83a Remove one extraneous backtick from line 116 of 'codebase-overview.md' (#8724). (#8726) 2017-01-09 14:06:37 -06:00
Stuart Harris c78e403d7b Added React London conference, March 28th (#8722)
Thanks :-)
2017-01-09 09:28:20 -08:00
Brian Vaughn 67c16e3148 Merge pull request #8706 from bvaughn/dont-recreate-masked-context-unless-needed
Dont recreate maked context unless unmasked context changes
2017-01-09 08:45:01 -08:00
Nik Nyby fa4f79f9fc docs: add missing period in shouldComponentUpdate doc (#8720) 2017-01-09 08:22:04 -08:00
Jirat Ki fb7e49439f Add component stack to invalid element type warning (#8495)
* Show Source Error Addemden if __source available

* Add Parent Stack on invalid element type

* refactor to use normalizeCodeLocInfo

* Remove ( ) from addendum
2017-01-09 07:26:01 -08:00
Dan Abramov fbfecd13ce Write a release guide (#8705)
* Write a release guide

* Style nit
2017-01-09 06:39:27 -08:00
Dan Abramov 6b1c86020d Add missing entry for #7750 to 15.4.2 changelog 2017-01-09 14:15:35 +00:00
Bruno Heridet 00846fd3a6 docs(hoc): fix typo Rambda → Ramda (#8712) 2017-01-08 10:26:46 -06:00
Andrew Clark 8ad0e0c25b Stop bubbling priority on equal priority
Unobservable perf fix. Previously we only stopped bubbling if the
priority was lower, but we can stop on equal priority, too.
2017-01-07 21:25:45 -08:00
Brian Vaughn a682059757 Dont recreate maked context unless unmasked context changes
Doing so can lead to infinite loops if componentWillReceiveProps() calls setState()
2017-01-07 08:53:24 -08:00
Brandon Dail 2085542d30 Remove fixture react build files from git tracking 2017-01-06 16:27:59 -06:00
Nathan Hunzaker 3d6a63d3c6 Remove primitive dom fixture READMEs for some test cases 2017-01-06 17:22:44 -05:00
Nathan Hunzaker 3c53d314a0 Move build fixtures to fixtures/build 2017-01-06 17:17:03 -05:00
Nathan Hunzaker c79b3f11fe Fix relative reference to build folder in DOM fixtures 2017-01-06 17:15:40 -05:00
Nathan Hunzaker 9d3ceb6895 Update readme for DOM Fixtures 2017-01-06 17:14:50 -05:00
Nathan Hunzaker 96171662aa Move current fixtures into dom folder 2017-01-06 17:10:41 -05:00
Nathan Hunzaker 5e53c0cea4 Add missing semicolon 2017-01-06 17:10:41 -05:00
Nathan Hunzaker d585590650 Address lint issues. 2017-01-06 17:10:41 -05:00
Nathan Hunzaker 565d63baa6 Remove trailing comma, causing crash in IE11 2017-01-06 17:10:41 -05:00
Nathan Hunzaker 3a51db27f2 Fix some CORS issues in IE 2017-01-06 17:10:41 -05:00
Nathan Hunzaker 2d75ae9fed Consolidate styles into single file 2017-01-06 17:10:41 -05:00
Nathan Hunzaker 1d1dd60899 Patch in console for IE9 2017-01-06 17:10:41 -05:00
Nathan Hunzaker b006d05275 Test, not text. 🔤 2017-01-06 17:10:41 -05:00
Nathan Hunzaker c31297b6d9 Remove extraneous binds from some fixtures 2017-01-06 17:10:41 -05:00
Nathan Hunzaker 85aa7eebfc Add test prompt message when no fixture is selected 2017-01-06 17:10:41 -05:00
Nathan Hunzaker f10a1a7c6f Copy local build before starting 2017-01-06 17:10:41 -05:00
Nathan Hunzaker 6de9ff2deb Remove babel include from react-loader 2017-01-06 17:10:41 -05:00
Brandon Dail 52a1ee492a Remove duplicate fixture components 2017-01-06 17:10:41 -05:00
Brandon Dail 5deb9826ca Use create-react-app for fixtures application
This moves the current fixture architecture to one based around create-react-app. There are a few important things to note:

* The react-loader.js script is always loaded before the bundle and will populate React and ReactDOM on the window. It is then read from the window by all components.
* The UI for the "React Sandbox" or "React Fixtures App" is also rendered with whatever version of React the user has selected. This means we dont have to deal with iframes or worry about multiple versions of React potentially interferring. But it also means that all components must be written using createClass to be fully backwards compatable. I tested back to 0.13.1 and it works fine.
2017-01-06 17:10:41 -05:00
Brandon Dail bf235489bf Display value for controlled select and textarea 2017-01-06 17:10:30 -05:00
Nathan Hunzaker f37ff31d2e Fix lint issues in react-loader 2017-01-06 17:10:30 -05:00
Nathan Hunzaker 187bcafe65 Update section on number inputs 2017-01-06 17:10:30 -05:00