ioBroker / create-adapter

Command line utility to create customized ioBroker adapters
MIT License
50 stars 23 forks source link

feat: switch to adapter-react-v5 #1096

Open stevenengland opened 8 months ago

stevenengland commented 8 months ago

PR Checklist:

Description:
This PR solves the issue https://github.com/ioBroker/create-adapter/issues/1095 by switching from adapter-react to adapter-react-v5.

stevenengland commented 8 months ago

I implemented that PR

I also created new adapters using the code base from this PR for TypeScript and for JavaScript as well. Both succeed. The newly created adapters then build fine. I was also able to start a dev-server instance for the newly created adapters. And now there comes the BUT.

In my dev environments, when I open the settings page of the adapter or the tab of the adapter, the content needs minutes to load. But then it loads the correct content and styled content. No errors in the console (except websocket reconnects) but one warning that made me curious. Here is a usual log containing this one. There it says:

"It looks like there are several instances of @mui/styles initialized in this application. This may cause theme propagation issues, broken class names, specificity issues, and makes your application bigger without a good reason."

Maybe this is the reason, why the loading process takes that long? I have no idea so far how to determine where those 2 instances are originating from. I must admit that I was am not a React user until now in combination with ioB.

grafik

Could anybody use this PR code to create a new adapter and check if the loading times in a dev-server instance are also as huge as in my dev-server instance?

stevenengland commented 8 months ago

Update: I recently recognized that the warnings and the slow loading only appear if the dev-server that is used for testing spins up a browser sync for HTML configuration. If it is set to jsonConfig there is no problem at all...

AlCalzone commented 8 months ago

I've had the issues with slow loading before. Seems to be some kind of incompatibility with the websocket proxy in dev-server and the self-written websocket server in iobroker that don't play along well.

I'll try to look at the PR soon. My time is pretty limited right now. Thanks for your work!

stevenengland commented 7 months ago

Before merging I guess this one should be closed beforehand: https://github.com/ioBroker/dev-server/issues/475 BrowserSync from the dev-server in combination with adapter-react-v5 causes this loading issues.