Skip to content

feat(frontend): update create community flow#62

Merged
germanurrus merged 76 commits intomainfrom
cas-132
Jul 5, 2022
Merged

feat(frontend): update create community flow#62
germanurrus merged 76 commits intomainfrom
cas-132

Conversation

@germanurrus
Copy link
Copy Markdown
Contributor

@germanurrus germanurrus commented Jun 21, 2022

To test this PR go to http://localhost:3000/#/community/create

Add extra step on community creation to configure strategies available for the new community:

Screen Shot 2022-06-27 at 10 57 49

Comment on lines -96 to -110
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' }} />,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated changes but this is not being used

Comment on lines +26 to +32
// only notify parent component if callback was passed
useEffect(() => {
if (onStrategySelection && !isEqual(strategies, existingStrategies)) {
onStrategySelection(strategies);
}
}, [strategies, onStrategySelection, existingStrategies]);

Copy link
Copy Markdown
Contributor Author

@germanurrus germanurrus Jun 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@germanurrus
Copy link
Copy Markdown
Contributor Author

@dbslone @CJamesKeller this one is new ready for review

@sarahy-Dapper sarahy-Dapper self-requested a review June 30, 2022 19:55
Copy link
Copy Markdown
Contributor

@sarahy-Dapper sarahy-Dapper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

// reloads lists if update is done
useEffect(() => {
// update state if new strategies are passed
useState(() => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this still be useEffect.

Copy link
Copy Markdown
Contributor Author

@germanurrus germanurrus Jun 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! I've removed the useEffect since props are not changing while component is loaded

Copy link
Copy Markdown
Contributor

@dbslone dbslone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@germanurrus
Copy link
Copy Markdown
Contributor Author

germanurrus commented Jul 1, 2022

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)

@germanurrus germanurrus merged commit e0d282d into main Jul 5, 2022
@germanurrus germanurrus deleted the cas-132 branch July 5, 2022 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants