You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like object export isn't correctly handled. In the following simplified example, NameInput has a warning, but it should actually be SomeInternalInput and SomeInternalForm OR TitleSection that had an error.
constSomeInternalInput=()=><div><NameInput/></div>constSomeInternalForm=()=><div/>// Shows a warning, even though it isn't exportedconstNameInput=styled(Input)` font-weight: 500;`;exportconstTitleSection={Input: SomeInternalInput,Form: SomeInternalForm,};
The text was updated successfully, but these errors were encountered:
I can try to better report errors, but this case is justified and the error is always more for the file than for a specific export.
This file can't be correctly Fast Refresh sadly (this technically could be should have support from the runtime to check that the object only export components et exactly the same keys than in the previous update, which not a one line simple update)
Thanks. Yeah I understand that it isn't supported by fast refresh, but it would be great to improve the warning placement to the actual variables that are exported.
ArnaudBarre
changed the title
Support export object pattern
Warn exports instead of components when using only components
Dec 4, 2023
So actually I've look at it and it correctly warns on all components that could loose state on Fast Refresh.
The action is too split the components from the export, sometimes it would mean moving the component to another file because it makes sense to export an object containing a component in that file, sometimes this would mean moving the export to another file because it's mostly an helper.
I think the current behaviour is ok but I'm open to changing the warning message to something else that would make it more clear when on the export side
It seems like object export isn't correctly handled. In the following simplified example,
NameInput
has a warning, but it should actually beSomeInternalInput
andSomeInternalForm
ORTitleSection
that had an error.The text was updated successfully, but these errors were encountered: