cloudinary-community / cloudinary-community/next-cloudinary

Table component bugs — falsy values lost, runtime crash when columns missing, class typo, and unstable keys

Open
#614 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
300
Forks
137
Avg merge
3m
Merged PRs (30d)
2

Description

This PR fixes multiple issues in `next-cloudinary/docs/components/Table/Table.js`:

- Preserve falsy values (like `0` and empty string) in cells by only replacing `null`/`undefined`.
- Add default fallbacks for `columns` and `data` to avoid runtime crashes.
- Guard usage of `columns` in tbody.
- Fix Tailwind class typo `last pr-0` -> `last:pr-0`.
- Avoid variable shadowing by renaming column index variable to `colIndex`.
- Use stable row keys (`row.id ?? rowIndex`) instead of just rowIndex.

Testing:
- Render table with `data` containing `0` and ensure `0` displays.
- Render component with `columns` undefined and some `data` and ensure no runtime error.
- Verify header / cell spacing respects `last:pr-0`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.