Bug: showFoldingButtons returns values instead of hiding buttons
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 25.9k
- Forks
- 2.4k
- Avg merge
- 13h 10m
- Merged PRs (30d)
- 4
Description
For falsey values (e.g. data = 0) this expression (data && condition) will return data (e.g. 0). This won't happen if it were to return strictly boolean values:
const showFoldingButtons = Boolean(props.data && Object.values(props.data).some(value => typeof value === 'object' && value !== null));
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open src/components/JsonViewer/JsonViewer.tsx at the referenced showFoldingButtons expression and verify how falsey data such as 0 is handled. Make the result strictly boolean as described in the issue, then confirm that folding buttons are hidden for falsey data and shown when nested object values exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100