SolidOS / SolidOS/solid-ui

Handling undefined value in table columns?

Open
#418 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
153
Forks
46
Avg merge
1d 8h
Merged PRs (30d)
7

Description

In the issue-pane, it is currently possible for a category to have an undefined value, which then means it doesn't show up in the table view.

This occurs because the filterFunction defined by renderEnumSelector in table.js will never return true for an undefined colValue
https://github.com/solid/solid-ui/blob/c2d0c8aed526db4e35640d9f3d543434a2c310ec/src/table.js#L1121-L1123

Possible solutions

It is possible this is simply a bug. searchValue defaults to {}, so !searchValue will always be false, even though a comment may or may not suggest the intended behaviour was to return true:
https://github.com/solid/solid-ui/blob/c2d0c8aed526db4e35640d9f3d543434a2c310ec/src/table.js#L1099-L1103

In this case, a solution would be to use:

return Object.keys(searchValue).length == 0 || colValue && searchValue[colValue.uri];

However, given that the default behaviour of table.js is to select all options, and on a desktop there is currently no way of unselecting all options, the UI would also need to change.

Instead of a new UI element or interaction to deselect all options (let's call that Solution 1), another solution would then be to add an option for undefined, which would have the advantage of being able to show only those options missing a category (Solution 2).

And rather than doing that automatically within table.js, another option is to simply not support undefined values (and perhaps to include some validation code, Solution 3). issue-pane would then need to make sure that a default value is always assigned for a category.

Not sure which of solution 1-3 would be preferred.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/table.js lines 1099-1123 and reproduce the issue-pane table behavior with an undefined category. Compare the three proposed behaviors—selection changes, an explicit undefined option, or validation/defaulting—with the current table UI, then confirm the chosen behavior covers both displaying rows and filtering them.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.