feat(frontend): update create community flow#62
Conversation
| description: | ||
| 'Some description of what you can write here that is useful.', | ||
| component: <StepOne />, | ||
| }, | ||
| { | ||
| label: 'Community Details', | ||
| description: | ||
| 'Some description of what you can write here that is useful.', | ||
| component: <StepTwo stepData={{ test: 'ok' }} />, | ||
| component: <StepTwo />, | ||
| }, | ||
| { | ||
| label: 'Proposal & Voting', | ||
| description: | ||
| 'Some description of what you can write here that is useful.', | ||
| component: <StepThree stepData={{ test: 'ok' }} />, |
There was a problem hiding this comment.
unrelated changes but this is not being used
| // only notify parent component if callback was passed | ||
| useEffect(() => { | ||
| if (onStrategySelection && !isEqual(strategies, existingStrategies)) { | ||
| onStrategySelection(strategies); | ||
| } | ||
| }, [strategies, onStrategySelection, existingStrategies]); | ||
|
|
There was a problem hiding this comment.
onStrategySelection: using this side effect because the state is inside this component and not in the parent component: const [strategies, setStrategies] = useState([]);
We need a way to notify parent component that a new strategy has been selected
|
@dbslone @CJamesKeller this one is new ready for review |
| // reloads lists if update is done | ||
| useEffect(() => { | ||
| // update state if new strategies are passed | ||
| useState(() => { |
There was a problem hiding this comment.
I think this still be useEffect.
There was a problem hiding this comment.
good catch! I've removed the useEffect since props are not changing while component is loaded
dbslone
left a comment
There was a problem hiding this comment.
When I go through the flow and add One Address One Vote as the first strategy then close the modal it goes into an infinite loop with the following error:
Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
at StepFour (http://localhost:3000/static/js/0.chunk.js:226:58)
at div
at div
at section
at StepByStep (http://localhost:3000/static/js/main.chunk.js:13129:95)
at CommunityCreate (http://localhost:3000/static/js/0.chunk.js:1870:93)
at Route (http://localhost:3000/static/js/vendors~main.chunk.js:138896:29)
at Switch (http://localhost:3000/static/js/vendors~main.chunk.js:139098:29)
at div
at div
at Suspense
at AppPages
at ErrorHandlerProvider (http://localhost:3000/static/js/main.chunk.js:18071:5)
at Router (http://localhost:3000/static/js/vendors~main.chunk.js:138527:30)
at HashRouter (http://localhost:3000/static/js/vendors~main.chunk.js:138193:35)
at NotificationModalProvider (http://localhost:3000/static/js/main.chunk.js:18294:5)
at Web3Provider (http://localhost:3000/static/js/main.chunk.js:18525:5)
at ErrorBoundary (http://localhost:3000/static/js/vendors~main.chunk.js:134210:37)
at App
@dbslone thanks for catching this. It's fixed now, there was an extra dependency causing the loop (110f465) |
To test this PR go to
http://localhost:3000/#/community/createAdd extra step on community creation to configure strategies available for the new community: