kobotoolbox / kpi

kpi is the (frontend) server for KoboToolbox. It includes an API for users to access data and manage their forms, question library, sharing settings, create reports, and export data.
https://www.kobotoolbox.org
GNU Affero General Public License v3.0
126 stars 170 forks source link

[TASK-771] Fix Single Submission modal crash bug #4951

Closed magicznyleszek closed 1 month ago

magicznyleszek commented 1 month ago

Checklist

  1. [ ] If you've added code that should be tested, add tests
  2. [ ] If you've changed APIs, update (or create!) the documentation
  3. [x] Ensure the tests pass
  4. [x] Make sure that your code lints and that you've followed our coding style
  5. [x] Write a title and, if necessary, a description of your work suitable for publishing in our release notes
  6. [x] Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. [ ] Open an issue in the docs if there are UI/UX changes

Description

Fixes app crash in Single Submission modal for a particular mix of repeat groups, XLSForm pulldata function and matrix type question. Also now point data (for types geopoint, geotrace, and geoshape) will be displayed as compact table in Single Submission modal.

Notes

I wasn't able to find a reproduction for this unfortunately. There are some details in Notion task that can help understand this more. The crash was happening, because the code was expecting an object, and was accessing a prop (obj[prop]), but was getting a null instead. The code in which the bug happens is already in TypeScript, but unfortunately we had any in three places in SubmissionResponse, and thus the bug could happen.

I thought I've introduced a bug in rendering point data, but it turned out the UI was already broken for any response with more than 3 points. I've improved it by rendering point data as table :)

Point data before (screenshot)

Screenshot 2024-05-28 at 21 09 54

Point data after (screenshot)

Screenshot 2024-05-28 at 21 09 58

Related issues

Related to #4942 as it touches the same area

notion-workspace[bot] commented 1 month ago

Preview issues under DATA > Table