facebook/react

Bug: [Refresh] Components resulting of HOCs composition immediately applied to render functions are ignored

davidbonnet opened this issue · 5 comments

React version: 17.0.2
React-refresh version: 0.10.0

Steps To Reproduce

Given the following files, making changes to Component.js doesn't trigger a re-render.

main.js module:

import React from 'react'
import { render } from 'react-dom'

import { Component } from './Component.js'

function App() {
  return <main><Component /></main>
}

render(<App />, window.document.getElementById('root'))

Component.js module:

import React, { memo } from 'react'
import { compose, withProps } from 'recompose'

export const Component = compose(memo, withProps({ value: 'Hello' }))(({ value }) => (<div>{value}</div>))

The current behavior

Making changes to Component.js does not re-render the element in main.js.
The transformed Component.js module does not register the Component for refresh.

The expected behavior

Making changes to Component.js does re-render the element in main.js.

Is this a new issue or an existing one?

Not that I know of.

I have encountered the same problem. The components wrapped with HOC are ignored by react refresh. There is no good solution yet

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!