kareemmahlees / tablex

Cross-Platform table viewer written in Rust

Home Page:https://tablex-tan.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migrating the frontend from NextJs to React + Vite

kareemmahlees opened this issue · comments

Motivation

Currently we are using Nextjs in the frontend, but we are not actually using any of Nextjs's features apart from the file based routing.

Nonetheless, It is actually introducing limitations, I spent a good 3 hrs trying to make Tauri's splash screen work with Nextjs but with no use.
Also Tauri invoke commands cannot be called inside of server components.
And also we are not using API routes.

The Solution

The solution is to migrate to just plain React + Vite and use Tanstack Router for routing ( which also offers file based routing, doing this will allow use to better handle problems and fill the missing gaps.

How to approach this

  • Initialize a new react project inside the apps folder and name the package @tablex/react-front
  • From her and on it will be just plain coping and pasting components
  • As for Tauri invoke commands, you can import the commands from the apps/core/src folder until we have finished migrating.
  • move lib, components and all other logic into the new project but this might be a good time to introduce some refactoring to how the code is structured
  • And at last, delete the old nextjs folder and replace it with the new react folder