Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of order rows do not work with sorts/filters #1527

Open
bofeiw opened this issue Jan 22, 2024 · 6 comments
Open

Out of order rows do not work with sorts/filters #1527

bofeiw opened this issue Jan 22, 2024 · 6 comments
Labels
bug Something isn't working help-wanted

Comments

@bofeiw
Copy link
Contributor

bofeiw commented Jan 22, 2024

Describe the bug

If there are out of order rows, they are always displayed regardless of the sorts or filters.

Here is an example screenshot of the issue. Filter is set to percentage=0.1 however there are rows whose percentage is 0 appearing in the UI. Notice that the row counter displays "loaded all 48 of 13 rows" which is incorrect.

Screenshot 2024-01-22 at 07 06 22

The cells with dotted red lines are the columns that require a value but those rows do not have a value. They are the "out of order" rows, and with the current code logic, those out of order rows have a high priority for display.

export const tableRowsAtom = atom<TableRow[]>((get) => {

export const tableRowsAtom = atom<TableRow[]>((get) => {
  const rowsDb = get(tableRowsDbAtom);
  const rowsLocal = get(tableRowsLocalAtom);
   
  ...

  // Merge the two arrays
  return [
    ...rowsLocalToMerge,
    ...rowsDb.filter((row) => rowsDbMap.has(row._rowy_ref.path)),
  ];
});

tableRowsDbAtom contains rows that are filtered, tableRowsLocalAtom contains rows that are out of order. tableRowsAtom combines the two row sets and the table UI directly renders them. This causes the our of order rows to always display in the table UI.

The "loaded all 48 of 13 rows" issue with the row counter is also related here. 48 is the combined number of rows (tableRowsAtom), 13 is the correct Firebase server count rows with filters.

To Reproduce
Steps to reproduce the behavior:

  1. In any table, have some columns and rows
  2. Add a new short text column and leave rows empty, mark it as required
  3. Apply filters, all rows are always displayed despite what filters are

#1315 is an example of this issue.

Expected behavior
Out of order rows should work with filters/sorts.

Possible solutions

  1. When sorts/filters are applied, do not include any out of order rows in tableRowsAtom. This is the simplest solution.
  2. Display out of order rows in a separate section. Need to think about how to implement the separation.
  3. Redesign how row atoms are structured so out of order rows are also filtered and sorted.
@bofeiw bofeiw added bug Something isn't working help-wanted labels Jan 22, 2024
@harinij
Copy link
Member

harinij commented Feb 1, 2024

/bounty $50

@rajdip-b
Copy link

rajdip-b commented Feb 1, 2024

/attempt #1527 can i be assigned?

Algora profile Completed bounties Tech Active attempts Options
@rajdip-b 9 bounties from 5 projects
TypeScript, JavaScript,
Jupyter Notebook & more
Cancel attempt

@rajdip-b
Copy link

rajdip-b commented Feb 1, 2024

image
image
image

@bofeiw hey, I tried to reproduce the issue. But it seems like it is working for me. Am I doing something wrong?

@kesh-007
Copy link

kesh-007 commented Mar 1, 2024

Is the issue is still open I am interested in working on this !

@basavaraja-v
Copy link

basavaraja-v commented Mar 13, 2024

/attempt #1527

1 similar comment
@rajeshj11
Copy link

rajeshj11 commented Mar 21, 2024

/attempt #1527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help-wanted
Projects
None yet
Development

No branches or pull requests

6 participants