profile
viewpoint

bvaughn/react 14

A declarative, efficient, and flexible JavaScript library for building user interfaces.

lunaruan/babel 2

🐠 Babel is a compiler for writing next generation JavaScript.

lunaruan/prop-types 2

Runtime type checking for React props and similar objects

lunaruan/react 2

A declarative, efficient, and flexible JavaScript library for building user interfaces.

lunaruan/fbt 1

A JavaScript Internationalization Framework

lunaruan/flow 1

Adds static typing to JavaScript to improve developer productivity and code quality.

lunaruan/react-codemod 1

React codemod scripts

lunaruan/reactjs.org 1

The React documentation website

mission-city-swing/mcs_registration 1

Mission City Swing Front Desk Registration

ashleybot/CarnieBots 0

Programming game for 3rd-5th graders

push eventlunaruan/reactjs.org

Dan Abramov

commit sha 6d6f37e0dd8933eab6759d133321fd17b1869348

more thanks

view details

push time in 2 days

push eventlunaruan/react-codemod

Luna

commit sha 37e734f235639eb8f38818742a96bb2e96c2a035

destructure named exports

view details

push time in 2 days

Pull request review commentreactjs/react-codemod

update-react-imports: Destructure named exports

 module.exports = function(file, api, options) {       })       .size() > 0; -  const reactPath = reactImportPath.paths()[0];-  const specifiers = reactPath.value.specifiers;+  // local: imported+  const reactIdentifiers = {};+  const reactTypeIdentifiers = {};+  let canDestructureReactVariable;+  if (reactImportInUse && isDefaultImport) {+    // Checks to see if the react variable is used itself (rather than used to access its properties)+    canDestructureReactVariable =+      root+        .find(j.Identifier, {+          name: 'React',+        })+        .filter(path => {+          return path.parent.parent.value.type !== 'ImportDeclaration';+        })+        .filter(+          path =>+            !(+              path.parent.value.type === 'MemberExpression' &&+              path.parent.value.object.name === 'React'+            ) &&+            !(+              path.parent.value.type === 'QualifiedTypeIdentifier' &&+              path.parent.value.qualification.name === 'React'+            ) &&+            !(+              path.parent.value.type === 'JSXMemberExpression' &&+              path.parent.value.object.name === 'React'+            ),+        )+        .size() === 0; -  for (let i = 0; i < specifiers.length; i++) {-    const specifier = specifiers[i];-    if (specifier.local.name === 'React') {-      if (specifier.type === 'ImportNamespaceSpecifier' && !keepReactImport) {-        j(reactPath).remove();+    if (canDestructureReactVariable) {+      // If a variable that we are trying to import has already been declared,+      // do not try to destructure imports

Named imports (both destructured and nondestructured) will always work. We are only planning on deprecating default imports.

lunaruan

comment created time in 2 days

PullRequestReviewEvent

Pull request review commentreactjs/react-codemod

update-react-imports: Destructure named exports

 module.exports = function(file, api, options) {   const printOptions = options.printOptions || {};   const root = j(file.source); -  const reactImportPath = root+  const variableAlreadyDeclared = variable => {+    const foo =+      root+        .find(j.Identifier, {+          name: variable,+        })+        .filter(+          path =>+            path.parent.value.type !== 'MemberExpression' &&+            path.parent.value.type !== 'QualifiedTypeIdentifier' &&+            path.parent.value.type !== 'JSXMemberExpression',+        )+        .size() > 0;+    return foo;

oh LOL oops I used foo so I could console.log the output and I forgot to change it >.>

lunaruan

comment created time in 2 days

PullRequestReviewEvent

Pull request review commentreactjs/react-codemod

update-react-imports: Destructure named exports

+import * as React from "react";++React.createElement('div', {});

I don't think the plan is to ever completely remove React.createElement. It'll still be there for people who want to manually create elements. We do plan to eventually stop letting the JSX transform use t.

lunaruan

comment created time in 2 days

PullRequestReviewEvent

pull request commentfacebook/react

Double Invoke Effects in __DEV__

if we DRY we'd also have to pass the MountDevFlag and what type of effect it is (Update or Passive). Too much or worth?

lunaruan

comment created time in 2 days

push eventlunaruan/reactjs.org

Luna

commit sha 6d2513f22562c07096b8fda1dc46f921bec9b12a

React v17.0 Release Candidate: Support for New JSX Transform

view details

push time in 3 days

Pull request review commentreactjs/reactjs.org

React v17.0 Release Candidate: Support for New JSX Transform

+---+title: "React v17.0 Release Candidate: Support for New JSX Transform"+author: [lunaruan,gaearon]+--- ++Although React 17 [doesn’t contain new features](https://reactjs.org/blog/2020/08/10/react-v17-rc.html), it provides support for a new JSX transform. In this post, we will describe these changes and provide steps so you can try the transform.++Browsers don’t understand JSX out of the box, so you need a compiler like Babel or TypeScript to transform JSX code into regular JavaScript. Toolkits like Create React App or Next.js also use the same tools under the hood.++We wanted to make a few improvements to the JSX transform, but we didn’t want to break existing setups, so worked with Babel to offer a new [JSX transform](https://babeljs.io/blog/2020/03/16/7.9.0#a-new-jsx-transform-11154-https-githubcom-babel-babel-pull-11154) for people who would like to upgrade.++The new transform is completely optional and has a few benefits:++* You can now **use JSX without importing React**.+* Depending on your setup, its compiled output may **slightly improve the bundle size**.+* In the long run, this will enable future improvements that **reduce the number of concepts** you need to learn React.++**This upgrade will not change JSX and is not required.** React supports the new JSX transform in 17.0. We also plan to backport it to React 16.14, 15.7, and 0.14.10 once React 17.0 is released. You can find the upgrade instructions for different tools below.++## How Does JSX Work?++When you use JSX, the compiler transforms it into React function calls that the browser can understand. For example, with the old JSX transform, compilers transformed JSX into `React.createElement(...)`.++For example,++```js+import React from 'react';++function App() {+   return <h1>Hello World</h1>;+}+```++would be transformed to++```js+import React from 'react';++function App() {+  return React.createElement('h1', null, 'Hello world');+}+```++However, this is not perfect:++* Because JSX compiled into `React.createElement`, the React library always needed to be in scope if you use JSX. +* There are some [performance improvements and simplifications](https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md#motivation) that `React.createElement` does not allow.++To solve these issues, React 17 introduces two new entry points to the React package that are intended to only be used by compilers like Babel and TypeScript. Instead of transforming JSX to `React.createElement`, the new transform imports special functions from those entry points. These functions will automatically be imported so **React no longer needs to be in scope** to use JSX.++For example,++```js+function App() {+  return <div>Hello World</h1>;

Oooh good catch. Thanks!

lunaruan

comment created time in 3 days

PullRequestReviewEvent

PR opened reactjs/reactjs.org

Reviewers
React v17.0 Release Candidate: Support for New JSX Transform

Blog post for JSX transform

+247 -0

0 comment

2 changed files

pr created time in 3 days

create barnchlunaruan/reactjs.org

branch : blog_post

created branch time in 3 days

Pull request review commentreactjs/react-codemod

update-react-imports: Destructure named exports

 npx react-codemod sort-comp <path>  #### `update-react-imports` -[As of Babel 7.9.0](https://babeljs.io/blog/2020/03/16/7.9.0#a-new-jsx-transform-11154-https-githubcom-babel-babel-pull-11154), when using `runtime: automatic` in `@babel/preset-react` or `@babel/plugin-transform-react-jsx`, you will not need to explicitly import React for compiling jsx. This codemod removes the redundant import statements. It also converts  (`import React from 'react'`) to named imports (`import * as React from 'react`).+[As of Babel 7.9.0](https://babeljs.io/blog/2020/03/16/7.9.0#a-new-jsx-transform-11154-https-githubcom-babel-babel-pull-11154), when using `runtime: automatic` in `@babel/preset-react` or `@babel/plugin-transform-react-jsx`, you will not need to explicitly import React for compiling jsx. This codemod removes the redundant import statements. It also converts  (`import React from 'react'`) to destructured named imports (`import { useState } as React from 'react`).

kay removed this edit for now

lunaruan

comment created time in 3 days

PullRequestReviewEvent

push eventlunaruan/react-codemod

Luna

commit sha 38ad4f25e48336d9fd79c884210444978bc5533d

destructure named exports

view details

push time in 3 days

Pull request review commentreactjs/react-codemod

update-react-imports: Destructure named exports

+import * as React from "react";++React.createElement('div', {});++createElement('someFunction');

If the variable createElement is already used we won't destructure the import

lunaruan

comment created time in 3 days

Pull request review commentreactjs/react-codemod

update-react-imports: Destructure named exports

+ 

Yup.

lunaruan

comment created time in 3 days

Pull request review commentreactjs/react-codemod

update-react-imports: Destructure named exports

+import { Fragment, useState } from "react";++<React.Fragment />

oh yeah good catcch!

lunaruan

comment created time in 3 days

Pull request review commentreactjs/react-codemod

update-react-imports: Destructure named exports

+import * as React from "react";++React.createElement('div', {});

Yeah to simplify the code, we don't destructure if either React is already being used or if the variable we're destructuring to (ex. createElement) is already being used. Open to changing though.

lunaruan

comment created time in 3 days

Pull request review commentreactjs/react-codemod

update-react-imports: Destructure named exports

+import * as React from 'react';

Yeah. Empty output means the file won't be edited (we return null).

lunaruan

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventlunaruan/react-codemod

Luna

commit sha cbbf42d672d560b6ec40f9e1d5701ef3d873b6f4

destructure named exports

view details

push time in 9 days

PullRequestReviewEvent

PR opened reactjs/react-codemod

update-react-imports: Destructure named exports

This PR updates the update-react-imports codemod. Previously, this codemod removed unused React imports (as a result of the new JSX transform) and converted default imports to named imports. This PR goes a step further and destructures those named imports (ex. import {useState} from 'react'

+266 -65

0 comment

12 changed files

pr created time in 11 days

push eventlunaruan/react-codemod

Luna

commit sha 91a783454e74b84a5e142f4257c938728f4c4613

destructure named exports

view details

push time in 11 days

create barnchlunaruan/react-codemod

branch : update_react_imports

created branch time in 11 days

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

pull request commentbabel/babel

Fix `jsxDEV` for generated elements

Is it OK if we cut a patch for this PR? We're planning on releasing React 17 in a couple of weeks which includes the React entrypoints for the new JSX transform changes. Thanks!

Timer

comment created time in 23 days

pull request commentfacebook/react

Double Invoke Effects in __DEV__

Updated the PR to address everyone's comments. Ready for review!

lunaruan

comment created time in a month

Pull request review commentfacebook/react

Double Invoke Effects in __DEV__

 function flushRenderPhaseStrictModeWarningsInDEV() {   } } +function commitDoubleInvokeEffectsInDEV(+  fiber: Fiber,+  hasPassiveEffects: boolean,+) {+  if (enableDoubleInvokingEffects) {+    if (__DEV__) {+      invokeLayoutEffectsUnmountInDEV(fiber);+      if (hasPassiveEffects) {+        invokePassiveEffectsUnmountInDEV(fiber);+      }++      invokeLayoutEffectsMountInDEV(fiber);+      if (hasPassiveEffects) {+        invokePassiveEffectsMountInDEV(fiber);+      }+    }+  }+}++function invokePassiveEffectsMountInDEV(firstChild): void {+  if (enableDoubleInvokingEffects) {+    if (__DEV__) {+      let fiber = firstChild;+      while (fiber !== null) {+        if (fiber.child !== null) {+          const primarySubtreeTag =+            fiber.subtreeTag & MountPassiveDevSubtreeTag;+          if (primarySubtreeTag !== NoSubtreeTag) {+            invokePassiveEffectsMountInDEV(fiber.child);+          }+        }++        const current = fiber.alternate;+        if (current === null && (fiber.effectTag & Passive) !== NoEffect) {+          invokeEffectMountInDEV(fiber, HookPassive | HookHasEffect);+        }+        fiber = fiber.sibling;+      }+    }+  }+}++function invokePassiveEffectsUnmountInDEV(firstChild): void {+  if (enableDoubleInvokingEffects) {+    if (__DEV__) {+      let fiber = firstChild;+      while (fiber !== null) {+        if (fiber.child !== null) {+          const primarySubtreeTag =+            fiber.subtreeTag & MountPassiveDevSubtreeTag;+          if (primarySubtreeTag !== NoSubtreeTag) {+            invokePassiveEffectsUnmountInDEV(fiber.child);+          }+        }++        const current = fiber.alternate;+        if (current === null && (fiber.effectTag & Passive) !== NoEffect) {+          invokeEffectUnmountInDEV(fiber, HookPassive | HookHasEffect);+        }+        fiber = fiber.sibling;+      }+    }+  }+}++function invokeLayoutEffectsMountInDEV(firstChild) {+  if (enableDoubleInvokingEffects) {+    if (__DEV__) {+      let fiber = firstChild;+      while (fiber !== null) {+        if (fiber.child !== null) {+          const primarySubtreeTag = fiber.subtreeTag & MountLayoutDevSubtreeTag;+          if (primarySubtreeTag !== NoSubtreeTag) {+            invokeLayoutEffectsMountInDEV(fiber.child);+          }+        }++        const effectTag = fiber.effectTag;+        const current = fiber.alternate;+        if (current === null && (effectTag & Update) !== NoEffect) {+          invokeEffectMountInDEV(fiber, HookLayout | HookHasEffect);+        }+        fiber = fiber.sibling;+      }+    }+  }+}++function invokeLayoutEffectsUnmountInDEV(firstChild) {+  if (enableDoubleInvokingEffects) {+    if (__DEV__) {+      let fiber = firstChild;+      while (fiber !== null) {+        if (fiber.child !== null) {+          const primarySubtreeTag = fiber.subtreeTag & MountLayoutDevSubtreeTag;+          if (primarySubtreeTag !== NoSubtreeTag) {+            invokeLayoutEffectsUnmountInDEV(fiber.child);+          }+        }++        const effectTag = fiber.effectTag;+        const current = fiber.alternate;++        if (current === null && (effectTag & Update) !== NoEffect) {+          invokeEffectUnmountInDEV(fiber, HookLayout | HookHasEffect);+        }+        fiber = fiber.sibling;+      }+    }+  }+}

Not sure whether we should DRY or not

lunaruan

comment created time in a month

PullRequestReviewEvent

push eventlunaruan/react

Luna

commit sha 0e34c6d9060c8f5525e367a4e9489d41ad55da65

offscreen double invoke effects

view details

push time in a month

push eventlunaruan/react

Luna

commit sha e69f6e937f00e34ad1ed23768a8abb812ca459c8

offscreen double invoke effects

view details

push time in a month

push eventlunaruan/react

Jordan Eldredge

commit sha 1d5e10f7035f0d3bcbffcd057a15940b1a20b164

[eslint-plugin-react-hooks] Report constant constructions (#19590) * [eslint-plugin-react-cooks] Report constant constructions The dependency array passed to a React hook can be thought of as a list of cache keys. On each render, if any dependency is not `===` its previous value, the hook will be rerun. Constructing a new object/array/function/etc directly within your render function means that the value will be referentially unique on each render. If you then use that value as a hook dependency, that hook will get a "cache miss" on every render, making the dependency array useless. This can be especially dangerous since it can cascade. If a hook such as `useMemo` is rerun on each render, not only are we bypassing the option to avoid potentially expensive work, but the value _returned_ by `useMemo` may end up being referentially unique on each render causing other downstream hooks or memoized components to become deoptimized. * Fix/remove existing tests * Don't give an autofix of wrapping object declarations It may not be safe to just wrap the declaration of an object, since the object may get mutated. Only offer this autofix for functions which are unlikely to get mutated. Also, update the message to clarify that the entire construction of the value should get wrapped. * Handle the long tail of nodes that will be referentially unique * Catch let/var constant constructions on initial assignment * Trim trailing whitespace * Address feedback from @gaearon * Rename "assignment" to "initialization" * Add test for a constant construction used in multiple dependency arrays

view details

Clay Tercek

commit sha fe6d05229f29c59ea2bbbd616cdfa0c6e2ea03fc

fix event.relatedTarget fallback logic for firefox (#19607) * fix event.relatedTarget fallback logic for firefox * check if relatedTarget is undefined for fallback

view details

Andrew Clark

commit sha 9abc2785cb070148d64fae81e523246b90b92016

Remove wasteful checks from `shouldYield` `shouldYield` will currently return `true` if there's a higher priority task in the Scheduler queue. Since we yield every 5ms anyway, this doesn't really have any practical benefit. On the contrary, the extra checks on every `shouldYield` call are wasteful.

view details

Andrew Clark

commit sha 3f8115cdd1e6ba237619cf8a7d433900dcf413c2

Remove `didTimeout` check from work loop No longer need this, since we have starvation protection in userspace. This will also allow us to remove the concept from the Scheduler package, which is nice because `postTask` doesn't currently support it.

view details

Brian Vaughn

commit sha 9b35dd2fcc8b8dfbd1363cef9e5c59a0deab0dd3

Permanently removed component stacks from scheduling profiler data (#19615) These stacks improve the profiler data but they're expensive to generate and generating them can also cause runtime errors in larger applications (although an exact repro has been hard to nail down). Removing them for now. We can revisit adding them after this profiler has been integrated into the DevTools extension and we can generate them lazily.

view details

Brian Vaughn

commit sha ffb749c95e0361b3cfbbfc4e1a73bfa2fda0aa93

Improve error boundary handling for unmounted subtrees (#19542) A passive effect's cleanup function may throw after an unmount. Prior to this commit, such an error would be ignored. (React would not notify any error boundaries.) After this commit, React's behavior varies depending on which reconciler fork is being used. For the old reconciler, React will call componentDidCatch for the nearest unmounted error boundary (if there is one). If there are no unmounted error boundaries, React will still swallow the error because the return pointer has been disconnected, so the normal error handling logic does not know how to traverse the tree to find the nearest still-mounted ancestor. For the new reconciler, React will skip any unmounted boundaries and look for a still-mounted boundary. If one is found, it will call getDerivedStateFromError and/or componentDidCatch (depending on the type of boundary). Tests have been added for both reconciler variants for now.

view details

Toru Kobayashi

commit sha 49cd77d24a5244d159be14671654da63932ea9be

fix: leak strict mode with UMD builds (#19614)

view details

CY Lim

commit sha 702fad4b1b48ac8f626ed3f35e8f86f5ea728084

refactor fb.me redirect link to reactjs.org/link (#19598) * refactor fb.me url to reactjs.org/link * Update ESLintRuleExhaustiveDeps-test.js * Update ReactDOMServerIntegrationUntrustedURL-test.internal.js * Update createReactClassIntegration-test.js * Update ReactDOMServerIntegrationUntrustedURL-test.internal.js Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

view details

Dan Abramov

commit sha ced05c46c114453ac4d8d469296f6ca3f96fe908

Update CHANGELOG.md

view details

Dan Abramov

commit sha e4afb2fddf6d1c596c703c384303a35d4d0d830f

eslint-plugin-react-hooks@4.1.0

view details

Jack Works

commit sha 1287670191e8e3bb193c83c18e587ccb8159a4ba

Fix: React cannot render in ShadowRoot (#15894) * fix: render in shadow root * fix: flow typing * Remove types and turn invariant into warning Co-authored-by: Dan Abramov <dan.abramov@me.com>

view details

Timothy Yung

commit sha 1a41a196bcb30d456d1692c4a40cb8273fa2cb92

Append text string to <Text> error message (#19581) * Append text string to <Text> error message * Truncate text in <Text> error message * Regenerate `codes.json`

view details

Brian Vaughn

commit sha bcca5a6ca78b33504e0a328c411b043261e7e303

Always skip unmounted/unmounting error boundaries (#19627) The behavior of error boundaries for passive effects that throw during cleanup was recently changed so that React ignores boundaries which are also unmounting in favor of still-mounted boundaries. This commit implements that same behavior for layout effects (useLayoutEffect, componentWillUnmount, and ref-detachment). The new, skip-unmounting-boundaries behavior is behind a feature flag (`skipUnmountedBoundaries`).

view details

Luna Ruan

commit sha ee409ea3b577f9ff37d36ccbfc642058ad783bb0

change destroy to safelyCallDestroy (#19605) We use safelyCallDestroy for commitUnmount and passive effects unmounts but we call destroy directly in commitHookEffectListUnmount (AKA layout effects unmounts because we don't use this anywhere else). This PR changes the direct destroy call to safelyCallDestroy for consistency

view details

ᴜɴвʏтᴇ

commit sha 24f1923b1b55f142c39364c88a57b2a1b90d3972

fix: open two same tabs on firefox (#19632) close #19629

view details

Brian Vaughn

commit sha 23595ff593b2e53ddfec2a08e848704d15d84b51

Add missing param to safelyCallDestroy() (#19638)

view details

Sam Marks

commit sha c45a195429b238587357f71a0e487dd80ed7c59f

fix: property list values should show whitespace (#19640)

view details

Toru Kobayashi

commit sha 32ca31306006d54d4887549b10608dc691cab055

refactor: remove unnecessary return statements (#19625)

view details

Julien Gilli

commit sha b8fa09e9e2b52d46e47ad604ef7c8c3529471b71

provide profiling bundle for react-reconciler (#19559)

view details

Sebastian Silbermann

commit sha 87b3e2d257e49b6d2c8e662830fc8f3c7d62f85f

Add flow to SyntheticEvent (#19564) * Add flow to SyntheticEvent * Minimal implementation of known and unknown synthetic events * less casting * Update EnterLeaveEventPlugin.js Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

view details

push time in a month

Pull request review commentfacebook/react

Double Invoke Effects in __DEV__

 function commitPassiveLifeCycles(finishedWork: Fiber): void {   } } +function commitDoubleInvokeEffectsInDEV(+  fiber: Fiber,+  hasPassiveEffects: boolean,+) {+  if (enableDoubleInvokingEffects) {+    if (__DEV__) {+      invokeLayoutEffectsUnmountInDEV(fiber);+      if (hasPassiveEffects) {+        invokePassiveEffectsUnmountInDEV(fiber);+      }++      invokeLayoutEffectsMountInDEV(fiber);+      if (hasPassiveEffects) {+        invokePassiveEffectsMountInDEV(fiber);+      }+    }+  }+}++function invokeLayoutEffectsUnmountInDEV(firstChild) {+  if (enableDoubleInvokingEffects) {+    if (__DEV__) {+      // unmount layout effects+      let fiber = firstChild;+      while (fiber !== null) {+        if (fiber.child !== null) {+          // Should we add a separate subtree tag for this?

Yeah, I wasn't sure how OK it was to add a subtree tag vs. just traversing extra in DEV since it takes extra bytes, and I know at least with effectTag, we don't seem to want to add too many. Thanks for clarifying!

lunaruan

comment created time in a month

PullRequestReviewEvent

Pull request review commentfacebook/react

Double Invoke Effects in __DEV__

 function commitPassiveLifeCycles(finishedWork: Fiber): void {   } } +function commitDoubleInvokeEffectsInDEV(+  fiber: Fiber,+  hasPassiveEffects: boolean,+) {+  if (enableDoubleInvokingEffects) {+    if (__DEV__) {+      invokeLayoutEffectsUnmountInDEV(fiber);+      if (hasPassiveEffects) {+        invokePassiveEffectsUnmountInDEV(fiber);+      }++      invokeLayoutEffectsMountInDEV(fiber);+      if (hasPassiveEffects) {+        invokePassiveEffectsMountInDEV(fiber);+      }+    }+  }+}++function invokeLayoutEffectsUnmountInDEV(firstChild) {+  if (enableDoubleInvokingEffects) {+    if (__DEV__) {+      // unmount layout effects+      let fiber = firstChild;+      while (fiber !== null) {+        if (fiber.child !== null) {+          // Should we add a separate subtree tag for this?+          const primarySubtreeTag = fiber.subtreeTag & LayoutSubtreeTag;+          if (primarySubtreeTag !== NoSubtreeTag) {+            invokeLayoutEffectsUnmountInDEV(fiber.child);+          }+        }++        const effectTag = fiber.effectTag;+        const current = fiber.alternate;+        // This is a mount+        if (current === null) {+          if (effectTag & Update) {+            switch (fiber.tag) {+              case FunctionComponent:+              case ForwardRef:+              case SimpleMemoComponent:+              case Block: {+                invokeGuardedCallback(

Hmm I'll leave it as is for now for consistency and maybe do a separate PR to make everything more consistent (Will creating a safelyCallCreate function cause perf issues)?

lunaruan

comment created time in a month

PullRequestReviewEvent

pull request commentfacebook/react

Add missing param to safelyCallDestroy()

Oops my bad I didn't pull your merged code from master before pushing

bvaughn

comment created time in a month

push eventfacebook/react

Luna Ruan

commit sha ee409ea3b577f9ff37d36ccbfc642058ad783bb0

change destroy to safelyCallDestroy (#19605) We use safelyCallDestroy for commitUnmount and passive effects unmounts but we call destroy directly in commitHookEffectListUnmount (AKA layout effects unmounts because we don't use this anywhere else). This PR changes the direct destroy call to safelyCallDestroy for consistency

view details

push time in a month

PR merged facebook/react

Reviewers
change destroy to safelyCallDestroy for Layout Effect Unmounts CLA Signed React Core Team

We use safelyCallDestroy for commitUnmount and passive effects unmounts but we call destroy directly in commitHookEffectListUnmount (AKA layout effects unmounts because we don't use this anywhere else). This PR changes the direct destroy call to safelyCallDestroy for consistency

+1 -1

3 comments

1 changed file

lunaruan

pr closed time in a month

pull request commentfacebook/react

Double Invoke Effects in __DEV__

Updated the PR based on everyone's comments!

lunaruan

comment created time in a month

push eventlunaruan/react

Luna

commit sha b4f716a9b945d543cb2dd8c6f526a69f69320738

offscreen double invoke effects

view details

push time in a month

Pull request review commentfacebook/react

Double Invoke Effects in __DEV__

+/**+ * 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+ */++'use strict';++let React;+let ReactFeatureFlags;+let ReactNoop;+let Scheduler;++describe('ReactDoubleInvokeEvents', () => {+  beforeEach(() => {+    jest.resetModules();+    React = require('react');+    ReactFeatureFlags = require('shared/ReactFeatureFlags');+    ReactNoop = require('react-noop-renderer');+    Scheduler = require('scheduler');+    ReactFeatureFlags.enableDoubleInvokingEffects = __VARIANT__;+  });++  it('double invoking for effects works properly', () => {+    function App({text}) {+      React.useEffect(() => {+        Scheduler.unstable_yieldValue('useEffect mount');+        return () => Scheduler.unstable_yieldValue('useEffect unmount');+      });++      React.useLayoutEffect(() => {+        Scheduler.unstable_yieldValue('useLayoutEffect mount');+        return () => Scheduler.unstable_yieldValue('useLayoutEffect unmount');+      });++      return text;+    }+    ReactNoop.act(() => {+      ReactNoop.render(<App text={'mount'} />);+    });++    if (__DEV__ && __VARIANT__) {+      expect(Scheduler).toHaveYielded([+        'useLayoutEffect mount',+        'useEffect mount',+        'useLayoutEffect unmount',+        'useEffect unmount',+        'useLayoutEffect mount',+        'useEffect mount',+      ]);+    } else {+      expect(Scheduler).toHaveYielded([+        'useLayoutEffect mount',+        'useEffect mount',+      ]);+    }++    ReactNoop.act(() => {+      ReactNoop.render(<App text={'update'} />);+    });++    expect(Scheduler).toHaveYielded([+      'useLayoutEffect unmount',+      'useLayoutEffect mount',+      'useEffect unmount',+      'useEffect mount',+    ]);++    ReactNoop.act(() => {+      ReactNoop.render(null);+    });++    expect(Scheduler).toHaveYielded([+      'useLayoutEffect unmount',+      'useEffect unmount',+    ]);+  });+  it('first useEffect double invokes before second useEffect is called', () => {

Good catch!

lunaruan

comment created time in a month

PR opened facebook/react

Reviewers
change destroy to safelyCallDestroy

We use safelyCallDestroy for commitUnmount and passive effects unmounts but we call destroy directly in commitHookEffectListUnmount (AKA layout effects unmounts because we don't use this anywhere else). This PR changes the direct destroy call to safelyCallDestroy for consistency

+1 -1

0 comment

1 changed file

pr created time in a month

create barnchlunaruan/react

branch : safelyCallDestroy

created branch time in a month

push eventlunaruan/react

Andrew Clark

commit sha 629125555f381764c9f4943e877985274ebbc1b6

[Scheduler] Re-throw unhandled errors (#19595) Because `postTask` returns a promise, errors inside a `postTask` callback result in the promise being rejected. If we don't catch those errors, then the browser will report an "Unhandled promise rejection" error. This is a confusing message to see in the console, because the fact that `postTask` is a promise-based API is an implementation detail from the perspective of the developer. "Promise rejection" is a red herring. On the other hand, if we do catch those errors, then we need to report the error to the user in some other way. What we really want is the default error reporting behavior that a normal, non-Promise browser event gets. So, we'll re-throw inside `setTimeout`.

view details

inottn

commit sha ccb6c39451b502c6b3ff3c014962827c54bae548

Remove unused argument (#19600)

view details

Brian Vaughn

commit sha c3ee973c5604078d5e9645a7e50db1842939d1e0

Fix emoji character displayed in Chrome extension (#19603)

view details

Sebastian Markbåge

commit sha dab0854c5e66ca74ca0591fd312d6a654e5aaaf1

Move commit passive unmount/mount to CommitWork (#19599)

view details

Luna

commit sha 8cee981a430ec242988f867a4d4a50fbe351fd72

offscreen double invoke effects

view details

push time in a month

pull request commentfacebook/react

Double Invoke Effects in __DEV__

Ready for review!

lunaruan

comment created time in a month

push eventlunaruan/react

Ricky

commit sha c8d9b8878a3a50fe94db5407727a3d5cba13f971

Speed up yarn cache in circle (#19566)

view details

Andrew Clark

commit sha b8ed6a1aa580e4de80f707293015d638d3252d63

[Scheduler] Call postTask directly (#19551) This updates the experimental Scheduler postTask build to call postTask directly, instead of managing our own custom queue and work loop. We still use a deadline 5ms mechanism to implement `shouldYield`. The main thing that postTask is currently missing is the continuation feature — when yielding to the main thread, the yielding task is sent to the back of the queue, instead of maintaining its position. While this would be nice to have, even without it, postTask may be good enough to replace our userspace implementation. We'll run some tests to see.

view details

Pascal Fong Kye

commit sha b6e1d086043a801682ff01b00c7a623d529b46c0

DevTools bug fix: Proxied methods should be safely dehydrated for display

view details

Luna

commit sha e51e75b17d3ebf4a9754761b4a4ba2635d298a1d

offscreen double invoke effects

view details

push time in a month

push eventlunaruan/react

Ricky

commit sha 86314d5b458348c06df810a67605e8dad1133dd1

Turn off new component stacks for React Native (#19521)

view details

Ricky

commit sha a437f3ff302dc92347d812d518c9a9659d9aa546

Use RN fork in default branch of feature flags (#19522)

view details

Halit Ogunc

commit sha 8d57ca519a3f8e7f76f81f404d048dfc35303d98

fix: typo in React Release Scripts (#19524)

view details

Dominic Gannaway

commit sha b61174fb7b09580c1ec2a8f55e73204b706d2935

Remove the deprecated React Flare event system (#19520)

view details

Dan Abramov

commit sha e9721e14e4b8776c107afa3cdd7c6d664fe20c24

Remove onScroll bubbling flag (#19535)

view details

Emilis Baliukonis

commit sha 5cff7755022220f24c1066643e0036b41806e8fa

[Scheduler] Get current time from performance.now in non-DOM environments (#19532) * Get current time from performance.now in non-DOM environments * Use local references to native APIs for Date and Performance * Refactored to read globals directly

view details

Brian Vaughn

commit sha e67a6b16030ebc30257a69a7fb36a9ed67f29b39

Fix runtime error that happens if a passive destroy function throws within an unmounted tree (#19543) A passive effect's cleanup function may throw after an unmount. In that event, React sometimes threw an uncaught runtime error trying to access a property on a null stateNode field. This commit fixes that (and adds a regression test).

view details

Dominic Gannaway

commit sha f77c7b9d76205d93908a06fb2d58ee8c31188d16

Re-add discrete flushing timeStamp heuristic (behind flag) (#19540)

view details

DaniAcu

commit sha 50893dbcb7030499eeecfa4b44539b603b757afd

fix(react-dom): unnecesary path on DOMEventProperties (#19544)

view details

Mateusz Burzyński

commit sha a5fed98a96c41cb852355f208bc86a9120f3227e

Register more node types that are used later as JSXIdentifiers (#19514)

view details

Gustavo Saiani

commit sha 5bdd4c8c60ed6c12c5af7ffb73660c8f91bf955a

Remove unused argument from call to jest method (#19546)

view details

Ricky

commit sha 32ff4286872d1a6bb8ce71730064f60ebbdd1509

Add feature flag for setting update lane priority (#19401) * Add feature flag for setting update lane priority * Remove second feature flag * Refactor feature flag locations * Add missing else

view details

Brian Vaughn

commit sha a63893ff320c39802e8c37fca84ea023f55230c9

Warn about undefined return value for memo and forwardRef (#19550)

view details

Dan Abramov

commit sha 336729856a1355ff264e3e5427c67bb23b708657

Nesting Fixture (#19531) * Nesting Fixture * Add README to nesting fixture * Apply suggestions from code review Co-authored-by: Ricky <rickhanlonii@gmail.com> * Fixes * Add Redux * Use different versions * Use Consumer API * Rename helper * Write docs * Update README.md * Update README.md Co-authored-by: Rick Hanlon <rickhanlonii@gmail.com>

view details

Dan Abramov

commit sha db2f22911083f5c8f5c637adf41bb7554928a339

Fix command

view details

Dan Abramov

commit sha 2d9ec9199ccdfa9872ccb0c86096547d63682cf4

Indent a command

view details

Andrew Clark

commit sha 0cd9a6de557f44dcfe79a4f287ca04b05d674bdc

Parallelize Jest in CI (#19552) Uses CircleCI's `parallelism` key to split our test jobs across multiple processes, like we do for the build job.

view details

Sebastian Silbermann

commit sha 7c30fb3b0b98d3e903e1dc60497f8e7ffb530153

Update outdated lockfile (#19568)

view details

Sebastian Silbermann

commit sha 7f696bd99c39348a631c20378d2a8704634bab04

fix: onFocus/onBlur/onBeforeInput have a matching event type (#19561) * test: Add current behavior for event types of onFocus/onBlur * fix: onFocus/onBlur have a matching event type * fix useFocus * fix: don't compare native event types with react event types * Add FocusIn/FocusOutEventInterface * A simpler alternative fix * Add regression tests * Always pass React event type and fix beforeinput Co-authored-by: Dan Abramov <dan.abramov@me.com>

view details

Dan Abramov

commit sha aa99b0b08e355fbbff3aaf6568d89b7a9c0e9705

Rename test files

view details

push time in a month

push eventlunaruan/react

Luna

commit sha 3f16f8deb9182a517495aff220b709ac5c75767b

offscreen double invoke effects

view details

push time in a month

push eventlunaruan/react

Luna

commit sha 65f42b3b0d28914320732824feeb2d2b042128d7

offscreen double invoke effects

view details

push time in a month

Pull request review commentfacebook/react

Double Invoke Effects in __DEV__

+/**+ * 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+ */++'use strict';++let React;+let ReactFeatureFlags;+let ReactNoop;+let Scheduler;++describe('ReactDoubleInvokeEvents', () => {+  beforeEach(() => {+    jest.resetModules();+    React = require('react');+    ReactFeatureFlags = require('shared/ReactFeatureFlags');+    ReactNoop = require('react-noop-renderer');+    Scheduler = require('scheduler');+    ReactFeatureFlags.enableDoubleInvokingEffects = true;+  });++  it('double invoking for effects works properly', () => {+    function App({text}) {+      React.useEffect(() => {+        Scheduler.unstable_yieldValue('useEffect mount');+        return () => Scheduler.unstable_yieldValue('useEffect unmount');+      });++      React.useLayoutEffect(() => {+        Scheduler.unstable_yieldValue('useLayoutEffect mount');+        return () => Scheduler.unstable_yieldValue('useLayoutEffect unmount');+      });++      return text;+    }+    ReactNoop.act(() => {+      ReactNoop.render(<App text={'mount'} />);+    });++    if (__DEV__) {+      expect(Scheduler).toHaveYielded([+        'useLayoutEffect mount',+        'useLayoutEffect unmount',+        'useLayoutEffect mount',+        'useEffect mount',+        'useEffect unmount',+        'useEffect mount',+      ]);+    } else {+      expect(Scheduler).toHaveYielded([+        'useLayoutEffect mount',+        'useEffect mount',+      ]);+    }++    ReactNoop.act(() => {+      ReactNoop.render(<App text={'update'} />);+    });++    if (__DEV__) {+      expect(Scheduler).toHaveYielded([+        'useLayoutEffect unmount',+        'useLayoutEffect mount',+        'useLayoutEffect unmount',+        'useLayoutEffect mount',+        'useEffect unmount',+        'useEffect mount',+        'useEffect unmount',+        'useEffect mount',+      ]);+    } else {+      expect(Scheduler).toHaveYielded([+        'useLayoutEffect unmount',+        'useLayoutEffect mount',+        'useEffect unmount',+        'useEffect mount',+      ]);+    }+  });+  it('first useEffect double invokes before second useEffect is called', () => {+    function App({text}) {+      React.useEffect(() => {+        Scheduler.unstable_yieldValue('useEffect One mount');+        return () => Scheduler.unstable_yieldValue('useEffect One unmount');+      });++      React.useEffect(() => {+        Scheduler.unstable_yieldValue('useEffect Two mount');+        return () => Scheduler.unstable_yieldValue('useEffect Two unmount');+      });++      return text;+    }++    ReactNoop.act(() => {+      ReactNoop.render(<App text={'mount'} />);+    });++    if (__DEV__) {+      expect(Scheduler).toHaveYielded([+        'useEffect One mount',+        'useEffect One unmount',+        'useEffect One mount',+        'useEffect Two mount',+        'useEffect Two unmount',+        'useEffect Two mount',+      ]);+    } else {+      expect(Scheduler).toHaveYielded([+        'useEffect One mount',+        'useEffect Two mount',+      ]);+    }++    ReactNoop.act(() => {+      ReactNoop.render(<App text={'update'} />);+    });++    if (__DEV__) {+      expect(Scheduler).toHaveYielded([+        'useEffect One unmount',+        'useEffect Two unmount',+        'useEffect One mount',+        'useEffect One unmount',+        'useEffect One mount',+        'useEffect Two mount',+        'useEffect Two unmount',+        'useEffect Two mount',

Talked to Sebastian last night after submitting this diff and we decided to only do this in mount (because unmount is called already during update). I can change the approach to not interleave the destroy/create function as well. That mirrors the hidden/suspense case better anyway!

lunaruan

comment created time in 2 months

push eventlunaruan/react

Luna

commit sha 4e1449892873313373028fba77c5a3af2e6bdf31

offscreen double invoke effects

view details

push time in 2 months

PR opened facebook/react

Reviewers
Double Invoke Effects in __DEV__

This PR double invokes effects in __DEV__ mode.

We are thinking about unmounting layout and/or passive effects for a hidden tree. To understand potential issues with this, we want to double invoke effects. This PR changes the behavior in DEV when an effect runs from create() to create() -> destroy() -> create(). The effect cleanup function will still be called before the effect runs in both dev and prod. (Note: this DEV behavior isn't final and still might change.)

+452 -100

0 comment

14 changed files

pr created time in 2 months

push eventlunaruan/react

Luna

commit sha c927a2c843c957edafb563eadd6bcfb948242f0a

offscreen double invoke effects

view details

push time in 2 months

push eventlunaruan/react

Luna

commit sha a853ff0c5733d75abecf0183f16bc525cee24295

offscreen double invoke effects

view details

push time in 2 months

push eventlunaruan/react

Luna

commit sha 47e5644b91ee62918164dc330b2b117ef92aaced

offscreen double invoke effects

view details

push time in 2 months

create barnchlunaruan/react

branch : double_invoke

created branch time in 2 months

Pull request review commentfacebook/react

Effects list refactor continued: passive effects traversal

 function commitUnmount(             const {destroy, tag} = effect;             if (destroy !== undefined) {               if ((tag & HookPassive) !== NoHookEffect) {-                enqueuePendingPassiveHookEffectUnmount(current, effect);+                effect.tag |= HookHasEffect;++                // subtreeTags bubble in resetChildLanes which doens't get called for unmounted subtrees.+                // So in the case of unmounts, we need to bubble passive effects explicitly.

One potential issue without the bailout case is that Offscreen children also satisfy the condition for bailing out. I could check whether a fiber is in an Offscreen subtree but it seems slightly messy, so I wonder if there's a better way to determine whether or not children not being cloned is because of bailout or because of Offscreen (perhaps a tag on the fiber indicating that we should stop traversing?)

bvaughn

comment created time in 2 months

create barnchlunaruan/react

branch : reset_child_lanes_refactor

created branch time in 2 months

pull request commentfacebook/react

Remove firstEffect from Persistent Mode Optimization

Interestingly I think the new refactor will “fix” the suspense list issue by making effects fire in first-to-last child order instead of the reveal order as was before.

What is the suspense list issue you all are referring to?

sebmarkbage

comment created time in 2 months

Pull request review commentfacebook/react

Effects list refactor continued: did-bailout flag

 function resetChildLanes(completedWork: Fiber) {         newChildLanes,         mergeLanes(child.lanes, child.childLanes),       );++      if (!didBailout) {

Yeah when didBailout is true I tried setting completedWork.childLanes to completedWork.alternate.childLanes. I didn't investigate much yet but a ton of tests failed.

bvaughn

comment created time in 2 months

push eventbvaughn/react

Luna

commit sha dffb2d7054be2b0b2a1fa308c21ce1f352b421e3

move bailout flag from while loop

view details

push time in 2 months

Pull request review commentfacebook/react

Effects list refactor continued: did-bailout flag

 function resetChildLanes(completedWork: Fiber) {         newChildLanes,         mergeLanes(child.lanes, child.childLanes),       );++      if (!didBailout) {

It seems like just copying the childLanes doesn't seem to work. Just doing the former for now. @bvaughn can maybe look into it more tomorrow?

bvaughn

comment created time in 2 months

push eventbvaughn/react

Luna

commit sha e9014b28fb4aea5171f767355f5c5d9565edffd9

use subtreeTag in passive effects

view details

push time in 2 months

push eventbvaughn/react

Luna

commit sha a4789b8ba4b207a6c1bde4d9dd663c6adf5fa6ee

use while loop instead of recursion for siblings

view details

push time in 2 months

push eventbvaughn/react

Luna

commit sha 3a76f9d3d942fac3b23ff90f3fcc5d73cdc57371

use while loop instead of recursion for siblings

view details

push time in 2 months

Pull request review commentfacebook/react

Effects list refactor continued: did-bailout flag

 function bailoutOnAlreadyFinishedWork(    // Check if the children have any pending work.   if (!includesSomeLane(renderLanes, workInProgress.childLanes)) {+    // TODO (effects)  The case we are trying to handle is an error thrown during commit,+    // and we replay the work, even though we skip render phase (by bailing out)+    // we don't want to bailout on commit effects too.+    // However, this check seems overly aggressive in some cases.

Oops nope.

bvaughn

comment created time in 2 months

push eventbvaughn/react

Luna

commit sha f4dabbdefdf29381d04e097c8f2884673465b488

fixed bugs

view details

push time in 2 months

push eventbvaughn/react

Luna

commit sha 9b8f1bcc6192d1f39826c88aed139577e682fd22

addressed comments

view details

push time in 2 months

push eventbvaughn/react

Luna

commit sha 596e69ddd13f3bba17e2b2cda8202e16d68bda18

addressed comments

view details

push time in 2 months

Pull request review commentfacebook/react

Effects list refactor continued: did-bailout flag

 function resetChildLanes(completedWork: Fiber) {         newChildLanes,         mergeLanes(child.lanes, child.childLanes),       );++      if (!didBailout) {+        subtreeTag |= child.subtreeTag & ~DidBailout;++        const effectTag = child.effectTag;+        if ((effectTag & BeforeMutationMask) !== NoEffect) {+          subtreeTag |= BeforeMutation;+        }+        if ((effectTag & MutationMask) !== NoEffect) {+          subtreeTag |= Mutation;+        }+        if ((effectTag & LayoutMask) !== NoEffect) {+          subtreeTag |= Layout;+        }+      }++      if ((child.effectTag & Incomplete) !== NoEffect) {+        childrenDidNotComplete = true;+      }+       child = child.sibling;     }   }    completedWork.childLanes = newChildLanes;++  if (!childrenDidNotComplete) {

I don't remember exactly why this was here (I think left over from a previous implementation when tests were failing to match with what the effect list was doing here. All the tests pass without this though so I'll remove.

bvaughn

comment created time in 2 months

issue closedfacebook/react

Warn for string refs where owner != __self

Sebastian wants to warn when owner !== __self, because this is the hard case to find when codemodding from string refs to callback refs.

closed time in 2 months

jimfb

issue commentfacebook/react

Warn for string refs where owner != __self

This is closed by #17864.

jimfb

comment created time in 2 months

create barnchlunaruan/react

branch : effect_list_refactor_bailout_flag

created branch time in 2 months

Pull request review commentfacebook/react

Effects list refactor

 function completeWork(                 // Reset the effect list before doing the second pass since that's now invalid.                 if (renderState.lastEffect === null) {                   workInProgress.firstEffect = null;+                  workInProgress.subtreeTag = NoEffect;+                  // TODO (effects) This probably isn't the best approach. Discuss with Brian

Nope we're good :D

bvaughn

comment created time in 2 months

PR closed facebook/react

Bisect CLA Signed React Core Team
+0 -0

5 comments

0 changed file

lunaruan

pr closed time in 2 months

pull request commentfacebook/react

Bisect

Oops was bisecting an error. Closing now!

lunaruan

comment created time in 2 months

create barnchlunaruan/react

branch : effect_list_refactor_2

created branch time in 2 months

Pull request review commentfacebook/react

[DO NOT MERGE] Effects list refactor

 function commitRootImpl(root, renderPriorityLevel) {   return null; } -function commitBeforeMutationEffects() {-  while (nextEffect !== null) {-    const current = nextEffect.alternate;+function commitBeforeMutationEffects(fiber: Fiber) {+  if (fiber.child !== null) {+    const primarySubtreeTag =+      fiber.subtreeTag & (Deletion | Snapshot | Passive | Placement);+    if (primarySubtreeTag !== NoEffect) {+      commitBeforeMutationEffects(fiber.child);+    }+  } -    if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) {-      if ((nextEffect.effectTag & Deletion) !== NoEffect) {-        if (doesFiberContain(nextEffect, focusedInstanceHandle)) {-          shouldFireAfterActiveInstanceBlur = true;-          beforeActiveInstanceBlur();-        }-      } else {-        // TODO: Move this out of the hot path using a dedicated effect tag.-        if (-          nextEffect.tag === SuspenseComponent &&-          isSuspenseBoundaryBeingHidden(current, nextEffect) &&-          doesFiberContain(nextEffect, focusedInstanceHandle)-        ) {-          shouldFireAfterActiveInstanceBlur = true;-          beforeActiveInstanceBlur();-        }-      }+  if (__DEV__) {+    setCurrentDebugFiberInDEV(fiber);+    invokeGuardedCallback(null, commitBeforeMutationEffectsImpl, null, fiber);+    if (hasCaughtError()) {+      const error = clearCaughtError();+      captureCommitPhaseError(fiber, error);+    }+    resetCurrentDebugFiberInDEV();+  } else {+    try {+      commitBeforeMutationEffectsImpl(fiber);+    } catch (error) {+      captureCommitPhaseError(fiber, error);     }+  } -    const effectTag = nextEffect.effectTag;-    if ((effectTag & Snapshot) !== NoEffect) {-      setCurrentDebugFiberInDEV(nextEffect);+  if (fiber.sibling !== null) {+    commitBeforeMutationEffects(fiber.sibling);+  }+} -      commitBeforeMutationEffectOnFiber(current, nextEffect);+function commitBeforeMutationEffectsImpl(fiber: Fiber) {+  const current = fiber.alternate;+  const effectTag = fiber.effectTag; -      resetCurrentDebugFiberInDEV();+  if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) {+    // The "deletions" array on a Fiber holds previous children that were marked for deletion.+    // However the overall commit sequence relies on child deletions being processed before parent's effects,+    // so to satisfy that we also process the parent's "deletions" array (the deletion of siblings).+    commitBeforeMutationEffectsDeletions(fiber.deletions);+    const parent = fiber.return;+    if (parent) {+      commitBeforeMutationEffectsDeletions(parent.deletions);     }-    if ((effectTag & Passive) !== NoEffect) {-      // If there are passive effects, schedule a callback to flush at-      // the earliest opportunity.-      if (!rootDoesHavePassiveEffects) {-        rootDoesHavePassiveEffects = true;-        scheduleCallback(NormalSchedulerPriority, () => {-          flushPassiveEffects();-          return null;-        });-      }++    // Check to see if the focused element was inside of a hidden (Suspense) subtree.+    // TODO: Move this out of the hot path using a dedicated effect tag.+    if (+      fiber.tag === SuspenseComponent &&+      isSuspenseBoundaryBeingHidden(current, fiber) &&+      doesFiberContain(fiber, focusedInstanceHandle)+    ) {+      shouldFireAfterActiveInstanceBlur = true;+      beforeActiveInstanceBlur();+    }+  }++  if ((effectTag & Snapshot) !== NoEffect) {+    setCurrentDebugFiberInDEV(fiber);+    commitBeforeMutationEffectOnFiber(current, fiber);+    resetCurrentDebugFiberInDEV();+  }++  if ((effectTag & Passive) !== NoEffect) {+    // If there are passive effects, schedule a callback to flush at+    // the earliest opportunity.+    if (!rootDoesHavePassiveEffects) {+      rootDoesHavePassiveEffects = true;+      scheduleCallback(NormalSchedulerPriority, () => {+        flushPassiveEffects();+        return null;+      });     }-    nextEffect = nextEffect.nextEffect;   } } -function commitMutationEffects(root: FiberRoot, renderPriorityLevel) {-  // TODO: Should probably move the bulk of this function to commitWork.-  while (nextEffect !== null) {-    setCurrentDebugFiberInDEV(nextEffect);+function commitBeforeMutationEffectsDeletions(deletions: Array<Fiber>) {+  for (let i = 0; i < deletions.length; i++) {+    const fiber = deletions[i]; -    const effectTag = nextEffect.effectTag;+    // TODO (effects) It would be nice to avoid calling doesFiberContain()+    // Maybe we can repurpose one of the subtreeTag positions for this instead?+    // Use it to store which part of the tree the focused instance is in?+    // This assumes we can safely determine that instance during the "render" phase. -    if (effectTag & ContentReset) {-      commitResetTextContent(nextEffect);+    if (doesFiberContain(fiber, ((focusedInstanceHandle: any): Fiber))) {+      shouldFireAfterActiveInstanceBlur = true;+      beforeActiveInstanceBlur();     }+  }+} -    if (effectTag & Ref) {-      const current = nextEffect.alternate;-      if (current !== null) {-        commitDetachRef(current);-      }+function commitMutationEffects(+  fiber: Fiber,+  root: FiberRoot,+  renderPriorityLevel,+) {

We talked about this! I think the reason why we didn't proceed was because refactoring it was a bit annoying and Brian wanted to get your response to the approach before we committed to doing this?

bvaughn

comment created time in 2 months

pull request commentreactjs/react-codemod

Update update-react-imports with early return

Done! (I think)

lunaruan

comment created time in 2 months

push eventreactjs/react-codemod

Luna

commit sha cae173b9a425a68afa581c8770fe56f94efc97b1

5.2.2

view details

push time in 2 months

pull request commentreactjs/react-codemod

Update update-react-imports with early return

Hey, I ran those commands and things seemed to work ok. LMK if I did it correctly or if there's something else I need to do!

lunaruan

comment created time in 2 months

push eventlunaruan/react-codemod

Luna Ruan

commit sha dd8671c9a470a2c342b221ec903c574cf31e9f57

add update-react-import codemod (#262)

view details

dependabot[bot]

commit sha 582d05e4c17c699d2cf317f4748e489fb7d98f43

Bump acorn from 5.7.3 to 5.7.4 (#256) Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

view details

Sunil Pai

commit sha 4e520606118ed69c1de8210234ca787af634d490

yarn upgrade

view details

Sunil Pai

commit sha da7925106ede5f660c8fade03f049d73caffe386

5.2.0

view details

Sunil Pai

commit sha c46e5f23763619201a82e9913766f1572bbbc49c

5.2.1

view details

Luna Ruan

commit sha 3d2216267bddd28cf8f1de60119ad3b92c16c1d7

fixed bugs (#266)

view details

Luna

commit sha cae173b9a425a68afa581c8770fe56f94efc97b1

5.2.2

view details

push time in 2 months

push eventlunaruan/react-codemod

Luna

commit sha ed2deae54beed1bff3c6789dcf30772e73720a40

fixed bugs

view details

push time in 2 months

PR opened reactjs/react-codemod

Reviewers
Update update-react-imports with early return

Sometimes, jscodeshift will modify files that it touched even though the codemod may not have actually modified any code. Because jscodeshift sometimes doesn't play well with types, this sometimes leads to files being modified unintentionally in strange ways. This PR adds an early return if we know we aren't going to modify any react imports in update-react-imports to avoid these unintentional modifications.

+4 -0

0 comment

1 changed file

pr created time in 2 months

create barnchlunaruan/react-codemod

branch : update-update-react-imports

created branch time in 2 months

push eventlunaruan/react

Brian Vaughn

commit sha 9d9cf383c9c7114d5feb51f8092eb76a2c09d9b0

Fixed test script handling of unknown/additional args (#19209)

view details

Sophie Alpert

commit sha e9c1445ba09ac0ae73465f28514f9aa45074b7c7

Add regression test for #18497 (#18538)

view details

Fred Vollmer

commit sha b0533fe33cbbd2c07f11bf3a1e97494a73698016

fix(eslint-plugin-react-hooks): Support optional chaining when accessing prototype method inside useCallback and useMemo #19061 (#19062) * fix(eslint-plugin-react-hooks): Support optional chaining when accessing prototype method #19061 * run prettier * Add fix for #19043

view details

Dan Abramov

commit sha 1887c5d9466094595ba535b99471c3dae04310d9

eslint-plugin-react-hooks@4.0.5

view details

jddxf

commit sha fa32cf299f514a0daa5ccd16fd8595b5cc6bc18b

Add regression tests where sync render causes later concurrent render to expire soon (#18608) * Add a failing test for #17911 * Add more test cases where sync render causes later concurrent render to expire soon

view details

Vetrivel Chinnasamy

commit sha b621dab5d4a334386a751eec4ed67502492f6776

make link https (#19147)

view details

Dan Abramov

commit sha 47ff31a77add22bef54aaed9d4fb62d5aa693afd

Revert "Add regression test for #18497 (#18538)" (#19215) This reverts commit e9c1445ba09ac0ae73465f28514f9aa45074b7c7.

view details

Brian Vaughn

commit sha 3ca6447df8c85a2eefb498047d5a2f50017af46f

Merge pull request #12 from lunaruan/brian_effects_list_refactor Suspense bugfixes

view details

Brian Vaughn

commit sha dc1303c04eb2b354f853b7acd377bb426c0ad52d

Updated TODO format

view details

Brian Vaughn

commit sha 3984427bc82e18cb7c4ec32bbb5564213f8ef68f

Merge branch 'master' into brian_effects_list_refactor

view details

Brian Vaughn

commit sha 62acd1fd00e9b6898b3e46bdad69c9d3650b9484

Fixed ContentReset bug with refactor

view details

Brian Vaughn

commit sha 408ff1a6d9469a6ae01b5a2297b6b2cadc5b3f0d

Fixed ReactSuspenseWithNoopRenderer test

view details

Brian Vaughn

commit sha e306017b7ec92b90f480f44907f20c3d107f2033

Fixed at least some of the foucs tests

view details

Brian Vaughn

commit sha acb003de0fa4a52b1f63e6478bc5e1e17b9a06dc

Fixed more focus tests (for hidden subspense case)

view details

Shailendra Gupta

commit sha f4097c1aef173ea0cb873bc18b47d1ef12bab4b3

Added warning to <Context.Provider> in case no value prop is provided (#19054) * added warning to context.provider in case no value prop * update message * updated message and pass undefined

view details

Dan Abramov

commit sha 8bff8987e513486bb96018b80d7edb02d095ed06

Don't bailout after Suspending in Legacy Mode (#19216) * Add a failing test for legacy Suspense blocking context updates in memo * Add more test case coverage for variations of #17356 * Don't bailout after Suspending in Legacy Mode Co-authored-by: Tharuka Devendra <tsdevendra1@gmail.com>

view details

Dan Abramov

commit sha f918b0eb41e0eabb8e4dc2bcd20fb8a25654d68f

Fix development mode hang when iframe is removed (#19220) * Fix development mode hang when iframe is removed * Also fix #16734

view details

Dominic Gannaway

commit sha b2bac7311a5279f2e64fd5c38d6e78d2bf90e893

Remove React Flare Keyboard responder (#19222)

view details

Brian Vaughn

commit sha d5ca0c19bd95c3c070d9785bda395e4b3ed974ca

Updated RN test to avoid false positive error

view details

Dan Abramov

commit sha 5707eeb2d2f13983b12cf56a0cdf242a21972dfe

Run ReactBrowserEventEmitter test on bundles (#19225) * Run ReactBrowserEventEmitter test on bundles * Rm bad tests

view details

push time in 3 months

push eventlunaruan/react

finico

commit sha ed94600fc6bbe0d6ea34a581672190e369b3d805

Remove unnecessary tag end from CommitRanked view (#19195)

view details

Christoph Nakazawa

commit sha 7d0e4150aa939ea843ab22bece1a415cbf2416cf

Fix react-runtime `main` field (#19193) The "main" field in this package points to a non-existent file. This fixes it.

view details

Ricky

commit sha 72bbcad160e9c2d27143f8bd617138a2790de3e9

Add new test cli (#19184) * Add new test cli * Remove --variant accidentally added to test-persist * s/test/tests * Updates from review * Update package.json tests * Missed a release channel in circle.yaml * Update config.yml to use just run: with test commands * Update release-channel options and add build dir checks * Update test args to use the new release-channel options * Fix error in circle config.yml * Fix a wrong condition for the --variant check * Fix a wrong condition for the --persistent check * Prettier * Require build check for devtool tests as well

view details

Dominic Gannaway

commit sha 3c1a7ac87c5b4903aa0de02d11bd9ec2590ad598

Move TOP_BEFORE_BLUR to bubble phase (#19197)

view details

Brian Vaughn

commit sha d255845e49f5eb5f67fec56aba0fb6e673540d27

Luna's branch imported

view details

Brian Vaughn

commit sha e2271cf5721c4aaeeec52bb4604ba8d830b91802

Incremental progress

view details

Luna Ruan

commit sha 63c75b0370a3293e8a41cac8e382a418e4d58eac

ContentReset + deletion bug fixes

view details

Brian Vaughn

commit sha a4d8bf83f9039d5951f923611602c2c882b9e034

Reverted SubtreeHasEffect, replaced with subtreeTag

view details

Brian Vaughn

commit sha ef153fc70b579d7926b584a7d0ce38c79eb41c6c

Minor tweaks

view details

Brian Vaughn

commit sha 069968472fb9cf1e102640b4da87dc3d3d042936

Fixed misc stuff

view details

Luna

commit sha 2baa0e136dd6be4e39b98f2586764b9e151852aa

Suspense bugfixes

view details

push time in 3 months

create barnchlunaruan/react

branch : brian_effects_list_refactor

created branch time in 3 months

push eventlunaruan/react

Luna Ruan

commit sha f146e8f93d638fd9ef1946bbd1f7ab97e16b94da

effects list refactor

view details

Luna Ruan

commit sha c2c00ada12e501ae65438c6ca6645b999dbd359a

mutation effects refactor

view details

push time in 3 months

push eventlunaruan/react

Brian Vaughn

commit sha cc7c1aece46a6b69b41958d731e0fd27c94bfc6c

Re-enabled DebugTracing feature for old reconciler fork (#19142) It was temporarily removed by @sebmarkbage via PR #18697. Newly re-added tracing is simplified, since the lane(s) data type does not require the (lossy) conversion between priority and expiration time values. @sebmarkbage mentioned that he removed this because it might get in the way of his planned discrete/sync refactor. I'm not sure if that concern still applies, but just in case- I have only re-added it to the old reconciler fork for now.

view details

Luna Ruan

commit sha f9042e932b730e7d0121b61569710d4d8c1073f6

empty

view details

push time in 3 months

more