Skip to content

fix(dms-kit): add defensive type check in useTableRequestError#818

Open
LordofAvernus wants to merge 1 commit intomainfrom
dms-ui/feat-787
Open

fix(dms-kit): add defensive type check in useTableRequestError#818
LordofAvernus wants to merge 1 commit intomainfrom
dms-ui/feat-787

Conversation

@LordofAvernus
Copy link
Copy Markdown
Collaborator

Summary

  • Add defensive type check in useTableRequestError hook to prevent crash when API returns non-JSON response
  • Returns empty list fallback instead of throwing when response data is not an object

Related: https://github.com/actiontech/dms-ee/issues/787

…vent crash on non-JSON response

When backend API returns HTML instead of JSON (e.g., unregistered route
falling through to static file middleware), response.data is a string.
Using 'in' operator on a string throws TypeError. Add typeof check
before accessing response.data properties, and set error message
instead of crashing. #787
@actiontech-bot actiontech-bot requested a review from LZS911 April 22, 2026 10:32
@github-actions
Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 80.68% 29140/36117
🟡 Branches 62.85% 10824/17222
🟢 Functions 84.04% 9822/11687
🟢 Lines 84.69% 27836/32867

Test suite run success

3643 tests passing in 810 suites.

Report generated by 🧪jest coverage report action from f724804

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.

1 participant