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

SPIKE: research getDerivedStateFromProps #118

Closed
alishaevn opened this issue Jan 12, 2023 · 3 comments
Closed

SPIKE: research getDerivedStateFromProps #118

alishaevn opened this issue Jan 12, 2023 · 3 comments
Assignees

Comments

@alishaevn
Copy link
Contributor

alishaevn commented Jan 12, 2023

story

this is a non customer facing issue

when loading the new request page, the console error below appears. we should look into whether we want to update our code per the mentioned docs.

demo

Image

@alishaevn alishaevn converted this from a draft issue Jan 12, 2023
@alishaevn alishaevn changed the title research getDerivedStateFromProps SPIKE: research getDerivedStateFromProps Jan 12, 2023
@alishaevn alishaevn moved this to Ready for Development in webstore Jan 24, 2023
@summer-cook summer-cook self-assigned this Jan 25, 2023
@summer-cook summer-cook moved this from Ready for Development to In Development in webstore Jan 25, 2023
@summer-cook
Copy link
Contributor

summer-cook commented Jan 25, 2023

The docs basically say that the lifecycle method componentWillReceiveProps is now being automatically renamed to UNSAFEcomponentWillRecieveProps and it should be replaced or potentially use the getDerivedStateFromProps instead

Good explanation of what is happening here:
https://stackoverflow.com/a/68705560/15106020 &
https://stackoverflow.com/questions/58924617/componentwillreceiveprops-has-been-renamed

This warning is an error coming from a dependency, vs. from our code (I searched all of webstore & component lib for componentWillReceiveProps), so I don't think there is much we can do about it unless we fork whatever dependency it is or wait for them to fix it in a newer release. Although, looking at the stack trace (ours look slightly different) it is kind of hard to tell which dependency.. unless its NextJS itself?

I did also find that nextJS is set to strict mode, so whichever dependency that is causing this must not be.

potential solutions

  • figure out which dependency this is & fork it to change the offending method
  • wait for this to be fixed in an update of the dependency
  • some users recommend disabling strict mode. I don't think we necessarily want to do that, but maybe just disabling it on this page could be an option

@alishaevn
Copy link
Contributor Author

tldr -- I'm ok with waiting for the dependency to be updated

since we're only using functional components in this app, we wouldn't have any lifecycle methods because they only exist in class components. whereas functional components use hooks.

if we knew which library was the offending one, it would be nice to open an issue against the repo. however, since this is just a warning and doesn't appear to be breaking anything atm, I'm fine with letting it be.

@summer-cook
Copy link
Contributor

summer-cook commented Jan 25, 2023

I'm looking at the stack trace again, and I see at the bottom it says update the following component: Form

our <Form> is coming from react json schema form, which I remember Steven saying has not been updated in a while, so that makes sense. i also looked at their repo and they did have a previously opened issue for this warning rjsf-team/react-jsonschema-form#2010 but it has since been closed
the fix that the guy proposed seemed pretty complicated. But i commented on it just in case to ask if they plan on fixing it

@summer-cook summer-cook moved this from In Development to Done in webstore Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants