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

Lists: Survey response columns don't handle undefined cell values #2513

Open
ziggabyte opened this issue Jan 31, 2025 · 0 comments
Open

Lists: Survey response columns don't handle undefined cell values #2513

ziggabyte opened this issue Jan 31, 2025 · 0 comments
Labels
🐜 bug Something isn't working 🐟 Small Should be a quick-ish fix.

Comments

@ziggabyte
Copy link
Contributor

Description

When adding a column of survey responses to a list, sometimes the organiser gets struck with an annoying "Application error"

@richardolsson says that he has only been able to reproduce this bug with live data, and not fake data, so in that way it's not "entry level" to work on it, BUT he did find what caused the bug and has kindly shared his fix here. So, you probably can't reproduce it, but you can solve it :)

diff --git a/src/features/views/components/ViewDataTable/columnTypes/SurveyResponseColumnType.tsx b/src/features/views/components/ViewDataTable/columnTypes/SurveyResponseColumnType.tsx
index 6ead3671d..08ced1c12 100644
--- a/src/features/views/components/ViewDataTable/columnTypes/SurveyResponseColumnType.tsx
+++ b/src/features/views/components/ViewDataTable/columnTypes/SurveyResponseColumnType.tsx
@@ -38,7 +38,7 @@ export default class SurveyResponseColumnType
       },
       valueGetter: (params: GridValueGetterParams) => {
         const cell: SurveyResponseViewCell = params.row[params.field];
-        return cell.map((response) => response.text);
+        return cell?.map((response) => response.text) ?? [];
       },
       width: 250,
     };


Steps to reproduce

  1. Talk to @richardolsson (see description)

Expected Behaviour

Adding a survey response column works, even if there are undefined cells

Actual Behaviour

Image

Screenshots (if you have any)

@ziggabyte ziggabyte added 🐜 bug Something isn't working 🐟 Small Should be a quick-ish fix. labels Jan 31, 2025
@Jrende Jrende assigned Jrende and unassigned Jrende Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐜 bug Something isn't working 🐟 Small Should be a quick-ish fix.
Projects
None yet
Development

No branches or pull requests

2 participants