Commit Graph
15395 Commits
Author SHA1 Message Date
Brian Vaughn 0ac84f3065 Added explicit Profiler goals to OVERVIEW 2019-03-06 18:30:17 -08:00
Brian Vaughn 4257ba4983 Changed profilerSummary messages to be lazy as well 2019-03-06 18:21:38 -08:00
Brian Vaughn 181e8aff30 Added planned Profiler architecture to OVERVIEW doc to share with others 2019-03-06 18:12:11 -08:00
Dan Abramov 6d2666bab1 Fix ESLint rule crash (#15044) 2019-03-07 00:39:39 +00:00
Dan Abramov 9b7e1d1389 [ESLint] Suggest moving inside a Hook or useCallback when bare function is a dependency (#15026)
* Warn about bare function deps and suggest moving or useCallback

* Clearer wording
2019-03-06 23:50:02 +00:00
Andrew Clark 1e3b6192b5 Import Scheduler directly, not via host config (#14984)
* Import Scheduler directly, not via host config

We currently schedule asynchronous tasks via the host config. (The host
config is a static/build-time dependency injection system that varies
across different renderers — DOM, native, test, and so on.) Instead of
calling platform APIs like `requestIdleCallback` directly, each renderer
implements a method called `scheduleDeferredCallback`.

We've since discovered that when scheduling tasks, it's crucial that
React work is placed in the same queue as other, non-React work on the
main thread. Otherwise, you easily end up in a starvation scenario where
rendering is constantly interrupted by less important tasks. You need a
centralized coordinator that is used both by React and by other
frameworks and application code. This coordinator must also have a
consistent API across all the different host environments, for
convention's sake and so product code is portable — e.g. so the same
component can work in both React Native and React Native Web.

This turned into the Scheduler package. We will have different builds of
Scheduler for each of our target platforms. With this approach, we treat
Scheduler like a built-in platform primitive that exists wherever React
is supported.

Now that we have this consistent interface, the indirection of the host
config no longer makes sense for the purpose of scheduling tasks. In
fact, we explicitly do not want renderers to scheduled task via any
system except the Scheduler package.

So, this PR removes `scheduleDeferredCallback` and its associated
methods from the host config in favor of directly importing Scheduler.

* Missed an extraneous export
2019-03-06 14:41:45 -08:00
Brian Vaughn e9028d1d35 Re-organized views slightly in preparation for Profiler UI 2019-03-06 14:01:52 -08:00
Brian Vaughn c18449326d Disabled transferrables for now (to avoid a Chrome runtime error) 2019-03-06 13:17:20 -08:00
Dan Abramov 5d49dafac8 Enforce deps array in useMemo and useCallback (#15025) 2019-03-06 18:17:54 +00:00
Brian Vaughn a9aa24ed8d 16.8.4 and changelog 2019-03-05 15:17:42 -08:00
Dan Abramov db8d466554 Fix heading in changelog 2019-03-05 22:40:04 +00:00
Dan Abramov fa5d4ee43b [ESLint] Treat functions that don't capture anything as static (#14996)
* Treat functions that don't capture anything as static

* Fix comment
2019-03-05 21:07:37 +00:00
Dan Abramov fd557d453d Warn on mount when deps are not an array (#15018)
* Warn on mount when deps are not an array

* Check other Hooks

* I can't figure out how to fix error/warning nesting lint

But it doesn't really matter much because we test other cases in the other test.
2019-03-05 17:41:27 +00:00
Farhad Yasir ff596e3efb fix(auto-version-update): update root package version while publishing (#15005)
* fix(auto-version-update): update root package version while publishing

* fix(remove-version): remove version field from package json
2019-03-04 12:36:17 -08:00
Andrew Clark ce45ca9ba3 Prettier 2019-03-04 11:38:08 -08:00
Andrew Clark 757a70b25d ReactNoop.yield -> Scheduler.yieldValue (#15008)
These used to be different things, but now ReactNoop.yield merely
re-exports Scheduler.yieldValue, so let's get rid of it.
2019-03-04 11:23:00 -08:00
Brian Vaughn 0db7770cf7 Merged master 2019-03-03 12:41:08 -08:00
Brian Vaughn 235851da87 Merge pull request #27 from gaurav5430/master
Update OVERVIEW.md
2019-03-03 08:14:05 -08:00
Gaurav Gupta f94401c10e Update OVERVIEW.md
Fixed the superscript reference
2019-03-03 18:29:58 +05:30
Andrew Clark 9d756d903f Revert #14756 changes to ReactFiberScheduler (#14992)
* Revert #14756 changes to ReactFiberScheduler

This PR introduced some bugs in concurrent mode during internal testing.
Until we figure out a proper solution, I'm going to try reverting it.

Not totally certain this is sufficient to unbreak the bugs we found, but
I'm using this branch to determine that.

* Add back commented out Scheduler import

With a note not to use named imports next time we import Scheduler
in this module.
2019-03-01 13:10:12 -08:00
Dan Abramov f16442a106 eslint-plugin-react-hooks@1.4.0 2019-03-01 20:29:06 +00:00
Dan Abramov e1e45fb367 [ESLint] Suggest to destructure props when they are only used as members (#14993)
* Suggest to destructure props when they are only used as members

* Add more tests

* Fix a bug
2019-03-01 19:48:48 +00:00
Dan Abramov 59ef28437a Warn about dependencies outside of render scope (#14990) 2019-03-01 18:16:17 +00:00
Brian Vaughn 515b60cc5e Fixed a typo in OVERVIEW 2019-03-01 08:38:05 -08:00
Brian Vaughn 8aa6f96279 Fixed selecterd element background color being cut-off when tree scrolls
This required a bit of unusual CSS but seems to work well for Firefox and Chrome. We can remove it and revisit other approaches (like PR#24) in the future if needed.
2019-03-01 08:28:16 -08:00
Dan Abramov df7b4768c7 [ESLint] Deduplicate suggested dependencies (#14982)
* Deduplicate suggested dependencies

* Tweak test cases
2019-03-01 16:10:22 +00:00
Dan Abramov 02404d793b Avoid dynamic dispatch for scheduler calls (#14968) 2019-03-01 15:04:15 +00:00
Brian Vaughn 0401f34f55 Removed unnecessary relative position style from Element CSS 2019-02-28 14:50:27 -08:00
Brian Vaughn bb2939ccc2 Support editable useState hooks in DevTools (#14906)
* ReactDebugHooks identifies State and Reducer hooks as editable
* Inject overrideHookState() method to DevTools to support editing in DEV builds
* Added an integration test for React DevTools, react-debug-tools, and overrideHookState
2019-02-28 14:37:55 -08:00
Brian Vaughn 90001e892d Udpated param name in injected renderer overrideHookState type 2019-02-28 13:55:49 -08:00
Brian Vaughn d70dbfdb65 Added intro to OVERVIEW 2019-02-28 13:46:36 -08:00
Brian Vaughn c249e31932 Fixed docs typo: chlid -> child 2019-02-28 13:26:39 -08:00
Brian Vaughn 7da5f83a28 Updated to account for facebook/react/pull/14906/commits/cdd9ba4 2019-02-28 13:22:27 -08:00
Brian Vaughn c7f8557202 Improve selected node highlighting by using minWidth instead of width 2019-02-28 12:56:49 -08:00
Andrew Clark 69060e1da6 Swap expect(ReactNoop) for expect(Scheduler) (#14971)
* Swap expect(ReactNoop) for expect(Scheduler)

In the previous commits, I upgraded our custom Jest matchers for the
noop and test renderers to use Scheduler under the hood.

Now that all these matchers are using Scheduler, we can drop
support for passing ReactNoop and test roots and always pass
Scheduler directly.

* Externalize Scheduler in noop and test bundles

I also noticed we don't need to regenerator runtime in noop anymore.
2019-02-28 12:54:47 -08:00
Andrew Clark ccb2a8a44e Replace test renderer's fake Scheduler implementation with mock build (#14970)
* Replace test renderer's fake Scheduler implementation with mock build

The test renderer has its own mock implementation of the Scheduler
interface, with the ability to partially render work in tests. Now that
this functionality has been lifted into a proper mock Scheduler build,
we can use that instead.

* Fix Profiler tests in prod
2019-02-28 10:50:38 -08:00
Brian Vaughn bffa72c601 Add placeholders to clarify between empty string, null, and undefined 2019-02-28 10:46:17 -08:00
Andrew Clark 53e787b45f Replace noop's fake Scheduler implementation with mock Scheduler build (#14969)
* Replace noop's fake Scheduler implementation with mock Scheduler build

The noop renderer has its own mock implementation of the Scheduler
interface, with the ability to partially render work in tests. Now that
this functionality has been lifted into a proper mock Scheduler build,
we can use that instead.

Most of the existing noop tests were unaffected, but I did have to make
some changes. The biggest one involved passive effects: previously, they
were scheduled on a separate queue from the queue that handles
rendering. After this change, both rendering and effects are scheduled
in the Scheduler queue. I think this is a better approach because tests
no longer have to worry about the difference; if you call `flushAll`,
all the work is flushed, both rendering and effects. But for those few
tests that do care to flush the rendering without the effects, that's
still possible using the `yieldValue` API.

Follow-up: Do the same for test renderer.

* Fix import to scheduler/unstable_mock
2019-02-28 10:30:46 -08:00
Brian Vaughn d34a32d389 Disable text selection in tree 2019-02-28 09:44:04 -08:00
Brian Vaughn d6a2ba2616 Added OVERVIEW doc 2019-02-28 08:52:54 -08:00
Brian Vaughn bcb6c2fd9f Removed an unnecessary entry from add-root operation array 2019-02-28 08:52:46 -08:00
Brian Vaughn 13ca37384d Maybe fixed checkbox alignment issue Dan reported? 2019-02-27 13:54:53 -08:00
Brian Vaughn 0153eaedee Left arrow selects parent in tree 2019-02-27 13:49:46 -08:00
Brian Vaughn bf02b2ffbf Select DOM element mode should useCapture to prevent clicks from passing through 2019-02-27 13:33:10 -08:00
Brian Vaughn 05ef0ad7dc Disable view-source button rather than hiding it to avoid jumping when selecting new components 2019-02-27 13:30:03 -08:00
Brian Vaughn 1e4434ecc4 Changed select-on-click to select-on-mouse-down and fixed a scrollIntoView problem 2019-02-27 13:11:23 -08:00
Brian Vaughn 8041bfb92f Add .vscode to .gitignore 2019-02-27 13:07:09 -08:00
Brian Vaughn bc4e8950f6 Updated test code to include a deeply nested DIV 2019-02-27 13:05:43 -08:00
Brian Vaughn 4d9e7e75c6 Merge branch 'scroll-into-view' of https://github.com/Jessidhia/react-devtools-experimental into Jessidhia-scroll-into-view 2019-02-27 12:58:03 -08:00
Dan Abramov 3ada82b741 Allow extraneous effect dependencies (#14967)
This makes cases like

  useEffect(() => {
    window.scrollTo(0, 0);
  }, [activeTab]);

not warn.

However, it still warns for unused useCallback/useMemo deps.
2019-02-27 16:59:11 +00:00