refinedev / refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.
https://refine.dev
MIT License
27.39k stars 2.11k forks source link

[BUG]Supabase data provider returns wrong sorted list for foreign table colmun #6229

Open noritsune opened 1 month ago

noritsune commented 1 month ago

Describe the bug

I tryed to sort by foreign table colmn with Supabase data provider. But the result is not sorted.

Steps To Reproduce

  1. Call getList() of Supabase data provider with sort option like below
    sorters: [
    {
      field: "categories.title",
      order: "asc",
    },
    ]
  2. Checks whether the results of getList() are sorted by a specified column, but they are not sorted

Expected behavior

The results of getList() are sorted by the specific column of foreign table.

Packages

@refinedev/supabase: 5.9.2

Additional Context

I already found how to fix this bug. If you assign me this issue, I can fix Supabase data provider refer to the following issue. https://github.com/supabase/supabase-js/issues/971

alicanerdurmaz commented 1 month ago

Hello @noritsune, thanks for improving Refine. I assigned it to you đź‘Ť

noritsune commented 1 month ago

Thank you for assign. I'm working for this issue.

aliemir commented 3 weeks ago

Hey @noritsune, any updates on this one? We'll be happy to help if you have any issues 🙏

noritsune commented 3 weeks ago

Hi @aliemir ,

I’ve researched ordering with Supabase SDK and PostgREST, and I found that Supabase relies on PostgREST for ordering. There are two types of ordering available:

However, the current Supabase DataProvider doesn't distinguish between these two ordering methods. It only supports Embedded Ordering at the moment.

To address this, I’m considering adding a meta.isEmbeddedOrdering option to the getList method within the DataProvider. I believe Top-level Ordering should be the default behavior, as it’s more suited for table views—such as in the example of blog posts.

What are your thoughts on this approach?

By the way, I’m unable to work on this issue at the moment. If there’s someone else who can take it on, please feel free to assign them. If not, I’ll plan to work on it in a few months.