Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete React Call/Return experiment #12820

Merged
merged 1 commit into from
May 15, 2018
Merged

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented May 15, 2018

We're not using this anywhere and it was always marked as completely unsafe so nobody should rely on this. It's taking up bundle size but per conversation with @sebmarkbage this model is insufficient for the layout use case he was interested in. Let's get rid of this and free up some space for actual features we're shipping, and come back to this when we have a better API in mind.

export const CallComponent = 7;
export const CallHandlerPhase = 8;
export const ReturnComponent = 9;
export const CallComponent_UNUSED = 7;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we leaving these in?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might rename/reuse them for next types we add?

Copy link
Collaborator

@sebmarkbage sebmarkbage May 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does anything rely on the type of work number? Just delete and collapse? (If something does rely on it, it should hurt so that a solution is encouraged. Even if it is us.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DevTools does.

Copy link
Collaborator

@acdlite acdlite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why you renamed the constants but didn't remove them?

@gaearon
Copy link
Collaborator Author

gaearon commented May 15, 2018

Just so we can use them for next types instead of leaving a hole. Since they're effectively "unclaimed".

I guess I can delete the symbols though.

Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll likely split this into two approaches in the future.

A lightweight one that might not be time sliced and useful for very local pairs.

And then a separate more powerful multipass approach for things like layout.

@gaearon
Copy link
Collaborator Author

gaearon commented May 15, 2018

The symbols are also ordered (0xeac7 -> 0xeac8 -> ...). So I'd prefer to keep them and then "fill them in" as necessary. I don't really care though. :-)

@pull-bot
Copy link

pull-bot commented May 15, 2018

ReactDOM: size: -0.9%, gzip: -0.7%

Details of bundled changes.

Comparing: d758960...7cd4907

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -0.7% -0.6% 646.72 KB 641.92 KB 148.4 KB 147.46 KB UMD_DEV
react-dom.production.min.js -0.9% -0.7% 101.12 KB 100.22 KB 32.36 KB 32.13 KB UMD_PROD
react-dom.development.js -0.8% -0.7% 631.08 KB 626.29 KB 144.33 KB 143.39 KB NODE_DEV
react-dom.production.min.js -0.9% -0.7% 99.53 KB 98.63 KB 31.45 KB 31.22 KB NODE_PROD
react-dom-server.browser.development.js -0.3% -0.3% 101.97 KB 101.65 KB 26.6 KB 26.53 KB UMD_DEV
react-dom-server.browser.production.min.js -0.6% -0.6% 15.17 KB 15.08 KB 5.81 KB 5.77 KB UMD_PROD
react-dom-server.browser.development.js -0.3% -0.3% 91.27 KB 90.96 KB 24.34 KB 24.27 KB NODE_DEV
react-dom-server.browser.production.min.js -0.7% -0.5% 14.54 KB 14.44 KB 5.55 KB 5.52 KB NODE_PROD
react-dom-server.node.development.js -0.3% -0.3% 93.2 KB 92.88 KB 24.88 KB 24.81 KB NODE_DEV
react-dom-server.node.production.min.js -0.6% -0.6% 15.34 KB 15.24 KB 5.84 KB 5.81 KB NODE_PROD
ReactDOM-dev.js -0.8% -0.6% 656.54 KB 651.48 KB 147.3 KB 146.37 KB FB_WWW_DEV
ReactDOM-prod.js -0.9% -0.7% 302.4 KB 299.63 KB 54.91 KB 54.55 KB FB_WWW_PROD
ReactDOMServer-dev.js -0.4% -0.3% 94.98 KB 94.63 KB 24.17 KB 24.1 KB FB_WWW_DEV
ReactDOMServer-prod.js -0.7% -0.6% 31.65 KB 31.42 KB 7.77 KB 7.73 KB FB_WWW_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -1.1% -0.9% 445.75 KB 440.96 KB 96.88 KB 95.99 KB UMD_DEV
react-art.production.min.js -1.0% -0.8% 92.64 KB 91.74 KB 28.24 KB 28 KB UMD_PROD
react-art.development.js -1.3% -1.2% 371.58 KB 366.79 KB 78.01 KB 77.09 KB NODE_DEV
react-art.production.min.js -1.6% -1.2% 57.15 KB 56.25 KB 17.5 KB 17.29 KB NODE_PROD
ReactART-dev.js -1.3% -1.2% 380.59 KB 375.54 KB 77.75 KB 76.8 KB FB_WWW_DEV
ReactART-prod.js -1.5% -1.2% 186.66 KB 183.91 KB 30.64 KB 30.28 KB FB_WWW_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js -1.3% -1.1% 376.54 KB 371.74 KB 78.87 KB 77.97 KB UMD_DEV
react-test-renderer.production.min.js -1.6% -1.7% 56.89 KB 55.98 KB 17.28 KB 16.98 KB UMD_PROD
react-test-renderer.development.js -1.3% -1.2% 367.36 KB 362.57 KB 76.19 KB 75.27 KB NODE_DEV
react-test-renderer.production.min.js -1.6% -1.6% 56.12 KB 55.22 KB 16.99 KB 16.72 KB NODE_PROD
react-test-renderer-shallow.development.js -1.0% -0.7% 24.5 KB 24.25 KB 6.53 KB 6.48 KB UMD_DEV
react-test-renderer-shallow.production.min.js -0.8% -0.3% 7.2 KB 7.14 KB 2.35 KB 2.35 KB UMD_PROD
react-test-renderer-shallow.development.js -1.7% -1.4% 14.54 KB 14.3 KB 3.63 KB 3.58 KB NODE_DEV
react-test-renderer-shallow.production.min.js -1.7% -1.4% 7.28 KB 7.16 KB 2.38 KB 2.35 KB NODE_PROD
ReactTestRenderer-dev.js -1.3% -1.2% 376.55 KB 371.5 KB 76.03 KB 75.09 KB FB_WWW_DEV
ReactShallowRenderer-dev.js -1.6% -1.3% 15.28 KB 15.04 KB 3.75 KB 3.71 KB FB_WWW_DEV

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js -1.4% -1.3% 347.66 KB 342.87 KB 71.59 KB 70.67 KB NODE_DEV
react-reconciler.production.min.js -1.8% -1.5% 48.85 KB 47.95 KB 14.74 KB 14.52 KB NODE_PROD
react-reconciler-persistent.development.js -1.4% -1.3% 346.86 KB 342.07 KB 71.29 KB 70.36 KB NODE_DEV
react-reconciler-persistent.production.min.js -1.9% -1.6% 47.79 KB 46.88 KB 14.54 KB 14.31 KB NODE_PROD
react-reconciler-reflection.development.js -2.1% -1.3% 11.69 KB 11.45 KB 3.57 KB 3.53 KB NODE_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js -1.0% -0.9% 488.52 KB 483.5 KB 103.84 KB 102.88 KB RN_FB_DEV
ReactNativeRenderer-prod.js -1.2% -1.0% 236.55 KB 233.66 KB 39.56 KB 39.19 KB RN_FB_PROD
ReactNativeRenderer-dev.js -1.0% -0.9% 488.18 KB 483.16 KB 103.75 KB 102.8 KB RN_OSS_DEV
ReactNativeRenderer-prod.js -1.3% -1.0% 222.76 KB 219.88 KB 37.39 KB 37.01 KB RN_OSS_PROD
ReactFabric-dev.js -1.1% -1.0% 471.79 KB 466.77 KB 100.08 KB 99.12 KB RN_FB_DEV
ReactFabric-prod.js -1.4% -1.2% 209.23 KB 206.25 KB 34.86 KB 34.43 KB RN_FB_PROD
ReactFabric-dev.js -1.1% -1.0% 471.83 KB 466.81 KB 100.09 KB 99.14 KB RN_OSS_DEV
ReactFabric-prod.js -1.4% -1.2% 209.26 KB 206.28 KB 34.88 KB 34.45 KB RN_OSS_PROD

Generated by 🚫 dangerJS

@gaearon gaearon merged commit 9097f3c into facebook:master May 15, 2018
@gaearon gaearon deleted the no-call-ret branch May 15, 2018 18:16
@rtsao
Copy link

rtsao commented May 20, 2018

Out of curiosity, what were the limitations of this model in terms of the mentioned layout use case? I'd love to hear more about that.

I've been toying around with this experiment to try and implement Subform layout, which so far has been promising.

@gaearon
Copy link
Collaborator Author

gaearon commented May 20, 2018

I think @sebmarkbage tried to do a Yoga integration at some point and it needed multipass?

Another issue is that the API is quite non-intuitive. It’s too generic and maybe more specialised forms (#12820 (review)) would be better.

@k15a
Copy link

k15a commented May 22, 2018

Is there any way this functionality can be implemented in userspace with the current React version? Maybe with the new context API?

@gaearon
Copy link
Collaborator Author

gaearon commented May 22, 2018

No. (If it was possible we wouldn’t do it in the core.)

@k15a
Copy link

k15a commented May 23, 2018

Appreciate your response. I thought a little bit more about call return because I think it would make compound components a lot nicer. Can you please explain what's the major difference between call return and the CellMeasurer of react-virtulized? As far as I understand it call return could be implemented in a similar way that CellMeasurer is. What's the major difference here?

@gaearon
Copy link
Collaborator Author

gaearon commented May 23, 2018

I'm not familiar with CellMeasurer. Maybe it's that call/return doesn't actually need to measure DOM nodes even if it's used for layout? It's more like a function call: it lets a parent know something about what happens inside a child component (if it opts in) during the rendering pass. A typical non-layout use case is "render first child that doesn't itself render to null".

bors bot referenced this pull request in mythmon/corsica-tree-status May 24, 2018
20: Update react monorepo to v16.4.0 r=renovate[bot] a=renovate[bot]

This Pull Request renovates the package group "react monorepo".


-   [react-dom](https://github.com/facebook/react) (`dependencies`): from `16.3.2` to `16.4.0`
-   [react](https://github.com/facebook/react) (`dependencies`): from `16.3.2` to `16.4.0`

# Release Notes
<details>
<summary>facebook/react</summary>

### [`v16.4.0`](https://github.com/facebook/react/blob/master/CHANGELOG.md#&#8203;1640-May-23-2018)
[Compare Source](facebook/react@8e5f12c...v16.4.0)
##### React

* Add a new [experimental](`https://github.com/reactjs/rfcs/pull/51`) `React.unstable_Profiler` component for measuring performance. ([@&#8203;bvaughn] in [#&#8203;12745](`https://github.com/facebook/react/pull/12745`))
##### React DOM

* Add support for the Pointer Events specification. ([@&#8203;philipp-spiess] in [#&#8203;12507](`https://github.com/facebook/react/pull/12507`))
* Properly call `getDerivedStateFromProps()` regardless of the reason for re-rendering. ([@&#8203;acdlite] in [#&#8203;12600](`https://github.com/facebook/react/pull/12600`) and [#&#8203;12802](`https://github.com/facebook/react/pull/12802`))
* Fix a bug that prevented context propagation in some cases. ([@&#8203;gaearon] in [#&#8203;12708](`https://github.com/facebook/react/pull/12708`))
* Fix re-rendering of components using `forwardRef()` on a deeper `setState()`. ([@&#8203;gaearon] in [#&#8203;12690](`https://github.com/facebook/react/pull/12690`))
* Fix some attributes incorrectly getting removed from custom element nodes. ([@&#8203;airamrguez] in [#&#8203;12702](`https://github.com/facebook/react/pull/12702`))
* Fix context providers to not bail out on children if there's a legacy context provider above. ([@&#8203;gaearon] in [#&#8203;12586](`https://github.com/facebook/react/pull/12586`))
* Add the ability to specify `propTypes` on a context provider component. ([@&#8203;nicolevy] in [#&#8203;12658](`https://github.com/facebook/react/pull/12658`))
* Fix a false positive warning when using `react-lifecycles-compat` in `<StrictMode>`. ([@&#8203;bvaughn] in [#&#8203;12644](`https://github.com/facebook/react/pull/12644`))
* Warn when the `forwardRef()` render function has `propTypes` or `defaultProps`. ([@&#8203;bvaughn] in [#&#8203;12644](`https://github.com/facebook/react/pull/12644`))
* Improve how `forwardRef()` and context consumers are displayed in the component stack. ([@&#8203;sophiebits] in [#&#8203;12777](`https://github.com/facebook/react/pull/12777`))
* Change internal event names. This can break third-party packages that rely on React internals in unsupported ways. ([@&#8203;philipp-spiess] in [#&#8203;12629](`https://github.com/facebook/react/pull/12629`))
##### React Test Renderer

* Fix the `getDerivedStateFromProps()` support to match the new React DOM behavior. ([@&#8203;koba04] in [#&#8203;12676](`https://github.com/facebook/react/pull/12676`))
* Fix a `testInstance.parent` crash when the parent is a fragment or another special node. ([@&#8203;gaearon] in [#&#8203;12813](`https://github.com/facebook/react/pull/12813`))
* `forwardRef()` components are now discoverable by the test renderer traversal methods. ([@&#8203;gaearon] in [#&#8203;12725](`https://github.com/facebook/react/pull/12725`))
* Shallow renderer now ignores `setState()` updaters that return `null` or `undefined`. ([@&#8203;koba04] in [#&#8203;12756](`https://github.com/facebook/react/pull/12756`))
##### React ART

* Fix reading context provided from the tree managed by React DOM. ([@&#8203;acdlite] in [#&#8203;12779](`https://github.com/facebook/react/pull/12779`))
##### React Call Return (Experimental)

* This experiment was deleted because it was affecting the bundle size and the API wasn't good enough. It's likely to come back in the future in some other form. ([@&#8203;gaearon] in [#&#8203;12820](`https://github.com/facebook/react/pull/12820`))
##### React Reconciler (Experimental)

* The [new host config shape](https://github.com/facebook/react/blob/c601f7a64640290af85c9f0e33c78480656b46bc/packages/react-noop-renderer/src/createReactNoop.js#L82-L285) is flat and doesn't use nested objects. ([@&#8203;gaearon] in [#&#8203;12792](`https://github.com/facebook/react/pull/12792`))

---


</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).

Co-authored-by: Renovate Bot <[email protected]>
bors bot referenced this pull request in mozilla/delivery-console May 24, 2018
164: Update react monorepo to v16.4.0 r=rehandalal a=renovate[bot]

This Pull Request renovates the package group "react monorepo".


-   [react-dom](https://github.com/facebook/react) (`dependencies`): from `16.3.2` to `16.4.0`
-   [react](https://github.com/facebook/react) (`dependencies`): from `16.3.2` to `16.4.0`

# Release Notes
<details>
<summary>facebook/react</summary>

### [`v16.4.0`](https://github.com/facebook/react/blob/master/CHANGELOG.md#&#8203;1640-May-23-2018)
[Compare Source](facebook/react@8e5f12c...v16.4.0)
##### React

* Add a new [experimental](`https://github.com/reactjs/rfcs/pull/51`) `React.unstable_Profiler` component for measuring performance. ([@&#8203;bvaughn] in [#&#8203;12745](`https://github.com/facebook/react/pull/12745`))
##### React DOM

* Add support for the Pointer Events specification. ([@&#8203;philipp-spiess] in [#&#8203;12507](`https://github.com/facebook/react/pull/12507`))
* Properly call `getDerivedStateFromProps()` regardless of the reason for re-rendering. ([@&#8203;acdlite] in [#&#8203;12600](`https://github.com/facebook/react/pull/12600`) and [#&#8203;12802](`https://github.com/facebook/react/pull/12802`))
* Fix a bug that prevented context propagation in some cases. ([@&#8203;gaearon] in [#&#8203;12708](`https://github.com/facebook/react/pull/12708`))
* Fix re-rendering of components using `forwardRef()` on a deeper `setState()`. ([@&#8203;gaearon] in [#&#8203;12690](`https://github.com/facebook/react/pull/12690`))
* Fix some attributes incorrectly getting removed from custom element nodes. ([@&#8203;airamrguez] in [#&#8203;12702](`https://github.com/facebook/react/pull/12702`))
* Fix context providers to not bail out on children if there's a legacy context provider above. ([@&#8203;gaearon] in [#&#8203;12586](`https://github.com/facebook/react/pull/12586`))
* Add the ability to specify `propTypes` on a context provider component. ([@&#8203;nicolevy] in [#&#8203;12658](`https://github.com/facebook/react/pull/12658`))
* Fix a false positive warning when using `react-lifecycles-compat` in `<StrictMode>`. ([@&#8203;bvaughn] in [#&#8203;12644](`https://github.com/facebook/react/pull/12644`))
* Warn when the `forwardRef()` render function has `propTypes` or `defaultProps`. ([@&#8203;bvaughn] in [#&#8203;12644](`https://github.com/facebook/react/pull/12644`))
* Improve how `forwardRef()` and context consumers are displayed in the component stack. ([@&#8203;sophiebits] in [#&#8203;12777](`https://github.com/facebook/react/pull/12777`))
* Change internal event names. This can break third-party packages that rely on React internals in unsupported ways. ([@&#8203;philipp-spiess] in [#&#8203;12629](`https://github.com/facebook/react/pull/12629`))
##### React Test Renderer

* Fix the `getDerivedStateFromProps()` support to match the new React DOM behavior. ([@&#8203;koba04] in [#&#8203;12676](`https://github.com/facebook/react/pull/12676`))
* Fix a `testInstance.parent` crash when the parent is a fragment or another special node. ([@&#8203;gaearon] in [#&#8203;12813](`https://github.com/facebook/react/pull/12813`))
* `forwardRef()` components are now discoverable by the test renderer traversal methods. ([@&#8203;gaearon] in [#&#8203;12725](`https://github.com/facebook/react/pull/12725`))
* Shallow renderer now ignores `setState()` updaters that return `null` or `undefined`. ([@&#8203;koba04] in [#&#8203;12756](`https://github.com/facebook/react/pull/12756`))
##### React ART

* Fix reading context provided from the tree managed by React DOM. ([@&#8203;acdlite] in [#&#8203;12779](`https://github.com/facebook/react/pull/12779`))
##### React Call Return (Experimental)

* This experiment was deleted because it was affecting the bundle size and the API wasn't good enough. It's likely to come back in the future in some other form. ([@&#8203;gaearon] in [#&#8203;12820](`https://github.com/facebook/react/pull/12820`))
##### React Reconciler (Experimental)

* The [new host config shape](https://github.com/facebook/react/blob/c601f7a64640290af85c9f0e33c78480656b46bc/packages/react-noop-renderer/src/createReactNoop.js#L82-L285) is flat and doesn't use nested objects. ([@&#8203;gaearon] in [#&#8203;12792](`https://github.com/facebook/react/pull/12792`))

---


</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).

Co-authored-by: Renovate Bot <[email protected]>
@BenLorantfy
Copy link

@k15a I almost kinda re-created this using only React but I had to make an awkward use of document.querySelectorAll. (which means it only works for react-dom).

https://github.com/BenLorantfy/react-lift-props
https://github.com/BenLorantfy/react-lift-props/blob/master/src/index.tsx#L41
https://medium.com/@benlorantfy/introducing-react-lift-props-490ee7cd958

If there was a way to get the "index" of a component in React, then I could avoid document.querySelectorAll.

<App>
  <Stepper>
    <MyStep>
      <Step /> <--- this would be index 0
    </MyStep>
    <MySecondStep>
      <Step /> <--- this would be index 1
    </MySecondStep>
  </Stepper>
</App>

@k15a
Copy link

k15a commented Jun 14, 2018

@BenLorantfy I got something similar to work with Context and Portals.
https://gist.github.com/k15a/e3dd7313b280af9a47a32845180cb8ef

@BenLorantfy
Copy link

Has there been any progress/ideas on a replacement for this API?

@nihgwu
Copy link
Contributor

nihgwu commented Aug 4, 2022

I think my package create-slots solves the same problem with a simpler mental model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants