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

Migrate react-scripts to vite #696

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

mfechner
Copy link

Fixes #695

To test this modification:

(cd ui && yarn)
(cd ui && yarn build)
go run .
(cd ui && yarn start)

Now access the address yarn start shows you.

In DEV mode, you just do:
go run .
(cd ui && yarn start)
In dev mode there is a proxy in vite used to not have CORS problem.
You can access the UI on:
http://localhost:5173
The UI prefix every request to the backup with `/api` so the proxy can correctly handle it, the proxy strips the `/api` so the backend is equal to production mode.
changing (observed) observable values without using an action
@mfechner mfechner mentioned this pull request Oct 15, 2024
@mfechner
Copy link
Author

Ok, to sum it up.
The migration to vite is more or less done.
But it seems that state management is broken, after a login the message component is not loaded.

I tried to update the router, but that is even worse. They broke the complete API and do not even provide a migration script for it.

As I mainly develop in Angular I need to read about react before I continue, but it seems that this upgrade to vite is depending on updating all libs to a more current version.

If someone else here have a strategy how to update the ui, any feedback is welcome.
I understand now the comment from @jmattheis that this will not be an easy task ;)

@jmattheis
Copy link
Member

@mfechner I feel you (:, I think the only good way it to start from scratch and copy component by component into a new project, so that you don't have to fix 100 errors to get something working. It's on my todo list, sadly it's multi hour effort.

@mfechner
Copy link
Author

@jmattheis thanks a lot for your feedback. I currently study react to better understand react itself.
It's to early to really make a statement here, but why you do not use the standard state management of react. That would help to get rid of a third party lib and would also simplify upgrade in the future.

I'm on this task but it will take some time ;)

@jmattheis
Copy link
Member

The codebase is quite old, pre react hooks. In my experience it wasn't that ergonomic to use contexts for global state, so I've used a lib. Currently I like https://github.com/pmndrs/zustand for it's simplicity and small footprint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Migrate react-scripts to vite
2 participants