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

Fix bug frontend questions editor #129

Merged
merged 3 commits into from
May 19, 2024
Merged

Fix bug frontend questions editor #129

merged 3 commits into from
May 19, 2024

Conversation

kahlstrm
Copy link

@kahlstrm kahlstrm commented May 13, 2024

When react-final-forma-arrays removes last element of array, it removes the field entirely. This caused a bug where removing the last question crashes the application.

@kahlstrm kahlstrm added 🐛 bug Something isn't working 🖥️ frontend Relevant to the ilmomasiina-frontend package labels May 13, 2024
@kahlstrm kahlstrm self-assigned this May 13, 2024
@kahlstrm kahlstrm mentioned this pull request May 13, 2024
@kahlstrm kahlstrm force-pushed the chore/minor-improvements branch 2 times, most recently from 636ce93 to 4294315 Compare May 14, 2024 16:55
When react-final-forma-arrays removes last element of array, it removes the field entirely. This caused a bug where removing the last question crashes the application.
@kahlstrm kahlstrm changed the title Minor improvements Fix bug frontend questions editor May 15, 2024
@kahlstrm kahlstrm merged commit 4a09f94 into dev May 19, 2024
3 checks passed
@kahlstrm kahlstrm deleted the chore/minor-improvements branch May 19, 2024 10:22
Comment on lines +157 to +159
const questionItems = fields.map((name, i) => (
<QuestionRow key={fields.value[i].key} name={name} index={i} remove={fields.remove} />
));
Copy link
Member

Choose a reason for hiding this comment

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

This existed to prevent the sortable HOC from re-rendering every time, which was a major perf bottleneck on the editor. Now it'll recreate the children and thus rerender from scratch every time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🖥️ frontend Relevant to the ilmomasiina-frontend package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants