caioricciuti / ch-ui

Use CH-UI to work with your data from Click House self-hosted with a user-friendly interface. CH-UI is a modern and feature-rich user interface for ClickHouse databases. It offers an intuitive platform for querying ClickHouse databases, executing queries, and visualizing metrics about your instance.
https://ch-ui.caioricciuti.com
MIT License
117 stars 12 forks source link

fix: blink when change organization #21

Closed thiagodsti closed 1 month ago

thiagodsti commented 1 month ago

So one of the reason why it was not blinking before is because the loading wasn't defined in the following method in store before.

 fetchAvailableCredentials: async (organizationId) => {
      try {
        const response = await api.get(
          `/clickhouse-credentials/available?organizationId=${organizationId}`
        );
        set({ availableCredentials: response.data });
      } catch (error) {
        throw new Error("Failed to fetch available credentials")
      }
    },

The second reason is because I removed the organizations loading.

The new change in the selector organization I added the proper loading working for credentials, but this is blinking the page, so the easiest solution was to remove that loading for now.

caioricciuti commented 1 month ago

image

Just pull, and still get, I'll take a look ;)

thiagodsti commented 1 month ago

Oh sorry so maybe I miss understood the problem 😓

caioricciuti commented 1 month ago

No problem at all, I've created the stores out of a tutorial and I'm not quite sure how things work deeply with react... I'm a data engineer and my program skills on front-end are quite limited (still learning), so I'm sure I've made lots of mistakes... I'll take some time now to organize the project deeply, I've created a project, to better organize things... Maybe it helps!

thiagodsti commented 1 month ago

Oh I see if you want we can have a call any day, my wife is also developer and focused in frontend I told her about this project and she wants to contribute as well 😊

thiagodsti commented 1 month ago

The stores should be used mainly for global variables that you have to use cross the whole project, for example when you logged in then you want to store the user session, when you select the organization you can also have it in the store to be global, but every time you add this then you are increasing the memory that your page is using and can it make the page slower