-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Hi, I'm seeking to use something like this in my own Tauri 2 application which uses Solid.JS.
While things work fairly well, I did notice that the maximize button did not change properly as the window was being maximized and unmaximized.
Looking at the code, I saw a number of issues I thought were worth addressing:
- Dependencies on
@tauri-apps/*needed to be updated. Not sure on the best policy here, given we're in "pre-release things breaking all the time" territory. - The Tauri APIs being used such as
plugin-os/typeandwindow/getCurrentnow return values not promises, which breaks the existing code. - Importing
@tauri-apps/apiasynchronously seems unnecessarily complicated. Is it for code splitting? If so, this doesn't seem like an appropriate code splitting point given that we would want correct window controls to appear immediately and seamlessly as soon as the application opens - The code in
plugin-os.tsseems a little overcomplicated and I'm not sure it works as intended. For example, it asserts that ifosTypePromise == nullthenosTypemust have a value, butosTypePromiseis never cleared after it resolves. - In
plugin-window.ts,createEffectandonCleanupare being used at the top-level which is not correct as they will not work outside a reactive root. This leads to console warnings, and is generally just more complicated than it has to be. - The
getCurrentWindowmethod doens't returnundefined, providing more opportunity to simplify code, remove?.operators, etc.
I will submit a PR soon with my proposed changes. I expect some push back so please let me know your concerns or questions about the changes, and if there's anything I've misunderstood above (like the rationale for loading @tauri-apps/api asyncronously) please let me know so I can amend the code and add a relevant explanatory comment.
arialpew and cyz1901
Metadata
Metadata
Assignees
Labels
No labels