Skip to content

Commit

Permalink
Upgraded to canary with priority level info
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed May 20, 2019
1 parent 53de5b6 commit d440380
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 54 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@
"opener": "^1.5.1",
"prettier": "^1.16.4",
"prop-types": "^15.6.2",
"react": "^0.0.0-6da04b5d8",
"react": "^0.0.0-50b50c26f",
"react-color": "^2.11.7",
"react-dom": "^0.0.0-6da04b5d8",
"react-is": "^0.0.0-6da04b5d8",
"react-test-renderer": "^0.0.0-6da04b5d8",
"react-dom": "^0.0.0-50b50c26f",
"react-is": "^0.0.0-50b50c26f",
"react-test-renderer": "^0.0.0-50b50c26f",
"react-virtualized-auto-sizer": "^1.0.2",
"react-window": "^1.8.0",
"request-promise": "^4.2.4",
"rimraf": "^2.6.3",
"scheduler": "^0.0.0-6da04b5d8",
"scheduler": "^0.0.0-50b50c26f",
"semver": "^5.5.1",
"style-loader": "^0.23.1",
"web-ext": "^3.0.0",
Expand Down
18 changes: 7 additions & 11 deletions shells/dev/app/ElementTypes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import React, {
lazy,
memo,
Component,
// $FlowFixMe Flow thinks ConcurrentMode is stable
unstable_ConcurrentMode as ConcurrentMode,
Fragment,
// $FlowFixMe Flow doesn't know about the Profiler import yet
Profiler,
Expand Down Expand Up @@ -48,15 +46,13 @@ export default function ElementTypes() {
<Context.Consumer>{value => null}</Context.Consumer>
</Context.Provider>
<StrictMode>
<ConcurrentMode>
<Suspense fallback={<div>Loading...</div>}>
<ClassComponent />
<FunctionComponent />
<MemoFunctionComponent />
<ForwardRefComponent />
<LazyComponent />
</Suspense>
</ConcurrentMode>
<Suspense fallback={<div>Loading...</div>}>
<ClassComponent />
<FunctionComponent />
<MemoFunctionComponent />
<ForwardRefComponent />
<LazyComponent />
</Suspense>
</StrictMode>
</Fragment>
</Profiler>
Expand Down
45 changes: 31 additions & 14 deletions shells/dev/app/PriorityLevels/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
// @flow

import React, { Fragment, useCallback, useState } from 'react';
import { unstable_next as next } from 'scheduler';
import {
unstable_IdlePriority as IdlePriority,
unstable_LowPriority as LowPriority,
unstable_runWithPriority as runWithPriority,
} from 'scheduler';

export default function PriorityLevels() {
const [count, setCount] = useState(0);
const [defaultPriority, setDefaultPriority] = useState<boolean>(false);
const [idlePriority, setIdlePriority] = useState<boolean>(false);
const [normalPriority, setLowPriority] = useState<boolean>(false);

const resetSequence = useCallback(() => {
setDefaultPriority(false);
setLowPriority(false);
setIdlePriority(false);
}, []);

const startSequence = useCallback(() => {
setCount(1);
next(() => setCount(2));
setDefaultPriority(true);
runWithPriority(LowPriority, () => setLowPriority(true));
runWithPriority(IdlePriority, () => setIdlePriority(true));
}, []);

const labels = [];
if (defaultPriority) {
labels.push('(default priority)');
}
if (normalPriority) {
labels.push('Low Priority');
}
if (idlePriority) {
labels.push('Idle Priority');
}

return (
<Fragment>
<h1>Priority Levels</h1>
<button onClick={startSequence}>start sequence</button>
{count >= 1 && <Text>One</Text>}
{count >= 2 && <Text>Two</Text>}
{count >= 2 && (
<div hidden>
<Text>Three</Text>
</div>
)}
<button onClick={resetSequence}>Reset</button>
<button onClick={startSequence}>Start sequence</button>
<span>{labels.join(', ')}</span>
</Fragment>
);
}

const Text = ({ children }) => children;
47 changes: 23 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9748,20 +9748,20 @@ react-color@^2.11.7:
reactcss "^1.2.0"
tinycolor2 "^1.4.1"

react-dom@^0.0.0-6da04b5d8:
version "0.0.0-6da04b5d8"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-0.0.0-6da04b5d8.tgz#ee78e45a40771560c756b8fc7f1fa213f2179ebe"
integrity sha512-6oyfkucrweqCB5XyLsfEnPSWhvkFnttutkU9uUQovLAljuazgpAjvBy6MBGSewKptqch2OTNwopqvR3QUMD8AQ==
react-dom@^0.0.0-50b50c26f:
version "0.0.0-50b50c26f"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-0.0.0-50b50c26f.tgz#3cd8da0f2276ed4b7a926e1807d2675b2eb40227"
integrity sha512-da9qleWDdBdAguEIDvvpFE0iuS8hfcCSGgZTYKRQMlSh5A94Ktr1otL4rgDTFH+bNsOwz3XrvEBYRA6WaE9xzQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "0.0.0-6da04b5d8"
scheduler "0.0.0-50b50c26f"

react-is@0.0.0-6da04b5d8, react-is@^0.0.0-6da04b5d8:
version "0.0.0-6da04b5d8"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-0.0.0-6da04b5d8.tgz#ded1f02e9f1e2b8456812d0d45c341d70b7bf7db"
integrity sha512-+Df3meqx+XUir+3dCqiHNAHruwmOAgXVp3TYmlUvgtPNBu+LF0OdchTMZ/xMUok1gYVoe4l/xhfs9CTEPkWt3g==
react-is@0.0.0-50b50c26f, react-is@^0.0.0-50b50c26f:
version "0.0.0-50b50c26f"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-0.0.0-50b50c26f.tgz#c4003ffffef9bd2b287979f9041a23d12a607bf2"
integrity sha512-9Y6ZvdOVmOxXs9mGuFy6eXHBww8RJCtJAh94b1hkbjhnW8Mb5ADScDoxJBVxcNuX9hvDkhENspC96ZQK1NIv3g==

react-is@^16.8.1:
version "16.8.3"
Expand All @@ -9773,15 +9773,15 @@ react-is@^16.8.4:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.4.tgz#90f336a68c3a29a096a3d648ab80e87ec61482a2"
integrity sha512-PVadd+WaUDOAciICm/J1waJaSvgq+4rHE/K70j0PFqKhkTBsPv/82UGQJNXAngz1fOQLLxI6z1sEDmJDQhCTAA==

react-test-renderer@^0.0.0-6da04b5d8:
version "0.0.0-6da04b5d8"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-0.0.0-6da04b5d8.tgz#01bed04c5a4cf22339f0ae3b23f89bb45e9a8f2a"
integrity sha512-yDt5RPDXLZXTqlWS0jXMJ1IyS1e/UZXSr0L8bG0UCsna4T7A3HIYR2zChlydGXsxjGMZntKqEfm27hUhFgC06Q==
react-test-renderer@^0.0.0-50b50c26f:
version "0.0.0-50b50c26f"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-0.0.0-50b50c26f.tgz#1a85cf9073ef5a932d03bee36fcfd9bf15aeae2c"
integrity sha512-gWc4L+mFIUCjvBpafR88n4/i/oaKHD6rzVyZY+XBou9MNtr2rRkjePOhBVsiYlCwkj+zZi6klV9b05TMzftosA==
dependencies:
object-assign "^4.1.1"
prop-types "^15.6.2"
react-is "0.0.0-6da04b5d8"
scheduler "0.0.0-6da04b5d8"
react-is "0.0.0-50b50c26f"
scheduler "0.0.0-50b50c26f"

react-virtualized-auto-sizer@^1.0.2:
version "1.0.2"
Expand All @@ -9796,15 +9796,14 @@ react-window@^1.8.0:
"@babel/runtime" "^7.0.0"
memoize-one ">=3.1.1 <6"

react@^0.0.0-6da04b5d8:
version "0.0.0-6da04b5d8"
resolved "https://registry.yarnpkg.com/react/-/react-0.0.0-6da04b5d8.tgz#583d81f73b26771da41170a5042a5ab0bdcfe37a"
integrity sha512-8hXBHwDCKxSVFqj5Kb4OskZz7//2fx2IpUnYyukYV8qyAHlXr0qUl3GxwuryhdPzJHlzi776WjN0YEmEEANhYA==
react@^0.0.0-50b50c26f:
version "0.0.0-50b50c26f"
resolved "https://registry.yarnpkg.com/react/-/react-0.0.0-50b50c26f.tgz#b782b579ce1f5d8bd696c5e45c744714ebecb111"
integrity sha512-jUAzS4DeWTdUZ/3kqm2T6C9OIpiAf2qdwVamCts0qzwYVni1/gUTOWK1ui0J+eaRzKxrIEzVvmCMxFd35lP/pA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "0.0.0-6da04b5d8"

reactcss@^1.2.0:
version "1.2.3"
Expand Down Expand Up @@ -10460,10 +10459,10 @@ sax@>=0.6.0, sax@^1.2.4:
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==

scheduler@0.0.0-6da04b5d8, scheduler@^0.0.0-6da04b5d8:
version "0.0.0-6da04b5d8"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.0.0-6da04b5d8.tgz#5e0ec65c2b0a7f05ffdc5522fc3a6d95b693e5c9"
integrity sha512-upTrWBZvk4IjMsC/AcRpgCwjnSQl8i78+07KmcndqWOnWp7s4wauowWXhyswP9vucLtZaN5ussFdM3d7dXcTkw==
scheduler@0.0.0-50b50c26f, scheduler@^0.0.0-50b50c26f:
version "0.0.0-50b50c26f"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.0.0-50b50c26f.tgz#09bedde1c64d7a042b557bee2dbf5faf5fd58a50"
integrity sha512-LBN3zrP8iBdILOoYxybFtkU7j+ldZTHORKyYyVLwXuIwGQ8/Xhs5VZjNQ5R2Xru2zv3GGVpJSbd47EpDuD2EHw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
Expand Down

0 comments on commit d440380

Please sign in to comment.