Closed Dschoordsch closed 1 year ago
Could we divide this into smaller issues? Perhaps re-write the AC to 1) discover all the places to refactor 2) open issues to break this refactoring into chunks?
My 2¢ as I'm currently doing a similar (but at a much smaller scale and with less complexity) HOC->hook migration for withAtmosphere
- there's currently 276 occurrences of createFragmentContainer(
, so ~226 components need to be migrated. This is a lot to change manually (it took me the better part of an hour to manually migrate 20(!) React class components to function components - a supposedly trivial migration in most cases), so I would strongly recommend automating this via something like jscodeshift. Even if we decide to approach this primarily through "in the neighborhood" refactoring, we should try to automate most of this to reduce the friction associated with changing one of these components - I don't want an engineer to have to take the time to read a doc on this to figure out how to manually perform the migration. I'd rather engineers just be told "run this script if you're changing a component with createFragmentContainer
, then go do whatever changes you want on that component".
FWIW I have some interest in picking this up (it's been a while since I've played with Babel+ASTs [shameless plug] and I've been meaning to check out jscodeshift), though I may not have capacity for a few sprints.
@jmtaber129 I think building some AST jscodeshift chops could be real, real nice. Discuss on your squad or pick up during a slack week!
(reopening since the closing PR only added automation to assist this effort; the AC still needs to be executed)
Stale issue
Was about to icebox, but I think we've done most of the work here to automate this migration. Will keep open a bit longer.
@jmtaber129 please let me know if you'd like to add anything to this Issue so that we prioritize it or decide to close it
Yea, all the automation is implemented, we just need to actually apply it.
I'll probably run a few batch migrations in the next few weeks, so let's keep it out of the icebox
createFragmentContainer
is deprecated and should be replaced withuseFragment
. See Partial data for details.Use the codeshift automation described in the migration doc to update most of the instances to the hook.
Acceptance criteria
createFragmentContainer
and replace them withuseFragment
fragment FooBar ...
fromcreateFragmentContainer
intouseFragment
FooBar
withFooBar$key
and pass touseFragment
UNSTABLE_renderPolicy: 'full'