-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
Proposal for go-app v10 - Your Suggestions and Deprecations Input #875
Comments
Hey Maxence, here are my views:
I have another change that I would like: Ignore nil arguments in I actually do not even think that most of my wishes need another major release. |
Hey @oderwat, thanks for the answer. |
I have to re-check. I thought I got errors with that. |
@oderwat thank you for sharing your insights.
I understand the concern. For context, in my codebase for Murlok.io, a significant portion of the string arguments are formatted with There are hundreds of calls in the current setup that could benefit from format args. Introducing an It's important to note that having a format string by default doesn't prevent the usage of the first argument as a non-format string. For instance, you can still perform concatenations like Additionally, the present implementation of |
@maxence-charriere I am fine without the "magic" and add my
But this is only possible if your check is there is more than one argument in the call, and all of my code will run slower. I also do not know if it actually changes the code the compiler produces with functions that accept variable arguments. I read some (old?) information that it has to be allocated to the heap, and even if not, it should take up space and make everything slower for those that do not want or need to use the format string. I did some quick and lazy experiments, and it seems at least to allocate the only/first variable in different memory regions. But even with |
Hey Maxence, My thoughts:
As @oderwat mentioned, I don't see any of these changes resulting in a new major version ( with the exception of 4 if the api changes quite a bit ). Matt |
The proposed changes to Regarding the documentation, I'd like to clarify a few points:
Additionally, I've been contemplating a project for some time that essentially replicates what the current documentation website does but makes it accessible for wider community use. Consequently, any issues related to documentation in this repository will be primarily centered on content. |
Could have a dependency injected like this:
Currently it always lands as an empty struct.
Specifically I'd like to see:
Unsure about moving it to a separated repo though, perhaps better to use |
Hello everyone, I've dedicated significant effort towards refining v10 recently, particularly focusing on the refactoring of the engine code. Here are the key updates:
Your feedback would be invaluable. Feel free to check out and try these changes on https://github.com/maxence-charriere/go-app/tree/node-manager |
@rtrzebinski #875 (comment) |
@maxence-charriere LGTM. We are in the middle of a large project, so I do not have too much time at hand. But I will try to get the branch running on the new version. Do you have some ETA for when v10 could be released? |
I estimate it will take another month or two. Currently, Murlok.io is utilizing it, but my priority is to ensure that it introduces a minimal number of breaking changes for users like you. I believe the work on the engine is nearing completion. Additionally, I'm looking into reworking the HTTP handler and will also be reviewing and potentially integrating some of the pending PRs. |
@maxence-charriere I'm testing this out now on a fairly large project and a go-app library used by that project. Migration to the new observe state code is trivial so far and improves readability. 👍 I'm stuck on how to trigger component updates since this method was removed: Lines 197 to 202 in 4af7476
I see the new update manager in the V10 code and how it is used internally. Lines 3 to 8 in 19e4353
What would be the correct way to trigger an update in V10? Thanks! |
@maxence-charriere We also do a lot of out of event handler component updates (like consumers that receive messages from NATS). I also still need the |
PreventUpdate is still there, just changed a bit to use the new update manager Lines 224 to 228 in b060dac
|
@maxence-charriere The lastURLVisited lines in Lines 274 to 286 in 3d07156
|
Before refactoring, I missed that
So to upgrade from V9 -> V10, existing code will need to implement the guard you mentioned in any func (a *Audio) OnMount(ctx app.Context) {
if app.IsServer {
return
}
// existing V9 component mounted code
} I refactored my app and go-app library to add the guard conditions in However, the behavior of I tracked it down to the Lines 155 to 160 in d8cf3a5
Lines 231 to 233 in e89c91b
But Lines 248 to 250 in e89c91b
This might be as simple as moving the setRoot up a dozen or so lines, but I don't know the implications of this. Note Edit: for what it is worth, moving node.go lines 231-233 after |
The primary purpose of this is to determine whether it's a fragment navigation and to avoid unnecessary page re-renders. This behavior has been in place since before, as seen here => https://github.com/maxence-charriere/go-app/blob/master/pkg/app/app.go#L311. Thank you for pointing this out. The current design results in |
I think that is better. We need "OnInit" to run once while mount/dismount components multiple times. I also do not want to have every OnMount needing to check it runs on the server. For us, it was all fine as it was before. Using preRender for what the bots see, OnInit to set stuff up before Render is called for the first time. OnMount to attach stuff to the node. Why are you changing these things? What is the advantage over how it worked before? To me, it looks a bit like changing stuff, for the purpose of changing stuff, and then we have to refactor everything until it works as it worked before the changes. Please consider that there are some users that write quite large PWA's that primarily focus on getting installed. There is no SEO or "link to some route" needed at all. In fact the SEO shows totally different information and all routes are going back to one handler which handles all state of the application. P.S.: I did not try the new changes myself, but from reading what @mlctrez wrote, the whole changes stop LGTM. |
Regarding pre-rendering, I noticed that my codebase started to accumulate duplicate calls. It became apparent that both the server and client often require the same calls, and using As for |
Sorry, I was not clear on what I was trying to convey here. The wasm build fails to compile because In the V10 branch, this variable block was removed ( code below is from V9 ) Lines 40 to 46 in 4af7476
|
We do not even have the same code for front-end routes and back end routes. So I guess it would never call our front-end OnMount() on the server. I guess we are looking at two complete different use cases. As |
I put back OnPreRender and OnInit. @mlctrez can you check if everything works? |
I reverted the conditional There is some delay being introduced in an
@maxence-charriere This comment was edited with some updates from today. Another update: I was able to reproduce the issue in the test application after bringing in some additional libraries that the other application used. At first the issue could not be reproduced until I matched the nats.io library version. nats.io v1.20.x does not appear to cause the issue but nats.io v1.30 does. Strangely enough as mentioned before, inserting a single I don't think that V10 needs to do anything different, but I do think that the upgrade docs for V9 -> V10 should mention this change in behavior. My solution was to wrap the nats call and the resulting context.NewAction call in a context.Defer |
I've implemented several updates on the v10 branch. Here's a summary of the latest changes:
@mlctrez, I've made some adjustments regarding the delay issue you mentioned. Could you please give it another try and let me know how it goes? |
@maxence-charriere I tested again against the new V10 branch and the delay is still present. I'll look into the nats.io source code some more and see if I can track down how it is uses goroutines, selects, channels, etc. What I suspect is happening is that there is contention for the JS UI thread between go-app and the nats.io code. The nats.io code is communicating using a web socket and the delay that I'm seeing when clicking on a component ends exactly when pings are sent across the web socket. |
@mlctrez we start all NATS consumers in their own go routines, and we also use debouncer code (which also makes them async) for most event handlers. @maxence-charriere I sadly still can't test the new go-app code as we are short before releasing our biggest go-app application into the beta-tester hell. So far it all worked out quite good. I guess we can check what happens to our code at the end of November. |
@maxence-charriere I finally found what was different between V9 and V10 that caused my UI delay. In V10, the frames ticker is reset to 1 Hour when the ticker fires. Lines 250 to 255 in 8e43917
In V9, the frames timer is doubled each time the dispatch length is 0 and the ticker fires: Lines 341 to 350 in 4af7476
I think that my code was somehow dependent on the frames code being executed more frequently. Again, I don't think this is something that should be changed for V10, since it is probably a rare case and adding a |
Some things I would like to see in go-app:
|
After replacing goappSetupAutoUpdate with goappTryUpdate , this line needs to be removed : Line 33 in cd97cdc
|
@mlctrez fixed |
@oderwat I made a PR for this: #942 Usage: // Event with scope
app.Div().OnScroll(func(cox app.Context, e app.Event){}, app.EventScope("1"))
// Passive event
app.Div().OnScroll(func(cox app.Context, e app.Event){}, app.PassiveEvent())
// Multiple options
app.Div().OnScroll(func(cox app.Context, e app.Event){},
app.PassiveEvent(),
app.EventScope("1"),
) |
@maxence-charriere this will need a lot of changes in our code and I do not like the idea to base multiple packages on a PR commit hash. I think it is a good way into the future to declare the event options using a concrete type. I would like that this is getting merged before we rewrite so much packages, just to rewrite them again, when it gets merged. |
Besides that I tested #942 in a smaller project, and it does what we need and is also fairly easy to updated and understand. I like that solution. |
BTW. I verified that "push notifications" (really "webpush") works with iOS 17.3.1 and the new (EU) 17.4 on the iPhone. I will test iPad later. It would be really cool if we could get the distinctions between "WebPush" and "Notifications" and implement a standard way for recognizing pushed notifications as I described above. See also #303 which was probably not seen by many people. @krustowski and I seem to have had the same journey to get it work. |
@maxence-charriere I wonder why |
@oderwat Good idea, this has been modied |
Not with our current apps. But we will most likely need inter tab communication (with local storage events or with event broadcast from the service worker) in the future. Our apps do not support forward/backward navigation anyway. I think it would be okay, to have it implemented but disabled by default. |
@maxence-charriere another "thing" We use "dark node" for some apps. So the default loading looks "wrong". I solve this by adding a raw header: RawHeaders: []string{`<style>
.goapp-app-info {
background-color: #000 !important;
color: white !important;
}
</style>`}, I think this should be configurable in |
you should be able to solve that with any css. |
Not just "any". I believe it has to be embedded in the page and use "!important", so it overrides your hard coded media query Something similar about the rotating Logo. Sure, one can do this, but I already had clients telling me that this looks unprofessional and lame. It would be nice if stuff like this could be changed more easily. P.S.: It does work like I posted in the comment before. I just do not find it very "nice" to override "my" own CSS (considering that any external person would wonder why I write CSS in "my" code just to override it all the time) |
this is how I made it on Murlok.io: .goapp-app-info {
color: var(--text-color);
background: var(--default-background);
} Does not seems to be |
@maxence-charriere Yes. It works as you say. I think there is this stupid bug(?) with Safari, that does not update the CSS used for the display when the app gets an update that changes CSS. It loads the new app but uses the former CSS. You need to hard kill the application and start it again. This is partly reproducible in Safari in OSX. I think that this was the problem we had, why it was not working the "easy" way when we tried this months ago. |
@maxence-charriere I think that we also need |
I don’t understand the need since it is non passive by default. Since you should not call prevent default with the passive option, a same handler should not be used for passive and non passive. |
Do you specify Very last comment here: https://stackoverflow.com/questions/44060131/zone-js-violation-warnings-on-console-in-angular-project-only-on-chrome/44339214#44339214 |
@oderwat from what I read, when there is no passive option, no passive field is set so the default value is whatever the browser set (which should be false). Chrome seems to be unhappy if you set a non passive handler with I think that issue should be handled in your code by making sure to not use prevent default in a passive handler. |
@maxence-charriere I think that there was something changed in Chrome which makes this obsolete. It all works for us without the problem that was mentioned in that StackOverflow article. I forgot to update / remove that request. |
@maxence-charriere I am not sure what is going on, but we now have a lot of times (while developing) that we get the message "installing app worker" but not the "app worker ... is activated" following. The app does not call the |
@oderwat, I noticed that on Murlok.io as well. I haven't changed anything, but I observed it occurs when the ads fail to load some elements. Do you see any errors or warnings in the browser console? |
@oderwat, I've just implemented a fix that addresses the issue of the service worker being activated before the WASM is loaded. Please let me know if this resolves the problem. |
@maxence-charriere I had some time to check the fix with different projects and "updater" setups, and it seems to solve the problems we saw before. Thank you! |
I'm planning to move forward and release version 10. This release is long overdue! 😀 A quick note on push notifications: I attempted to migrate them to the service worker, but unfortunately, I wasn’t successful. If there's anything specific you think needs to be addressed before the v10 release, please let me know. |
why private app.Value addEventListener method ? |
@gepengscu A javascript value is not necessary a DOM element. |
Hello go-app community,
I hope you're all doing well. As I start working on the next major version of go-app (v10), I want to involve you in the decision-making process by inviting your suggestions and thoughts on new features and potential changes.
What I'm Seeking
I truly value your insights. If you've been holding onto ideas or have suggestions to improve go-app, now is the perfect time to share them. Please take a moment to comment below with your thoughts on what you'd like to see in v10.
Proposed Changes
For this upcoming version, I have a couple of modifications in mind that I'd like to discuss with you:
Deprecation of
app.If(v bool, v ...app.UI)
Call:Currently, the
app.If(v boo, v ...app.UIl)
call generates unnecessary memory allocations. To address this, I'm considering replacing it withapp.If(v bool, func() app.UI)
. My goal is to retain the familiar code semantics while boosting efficiency. I'm eager to know your perspective on this change and whether it aligns with your needs.Transition of String Argument Functions to Format Version, Including
app.Text
and OtherText
Methods:Another proposal is to transition functions that currently take a string argument to a format version. This would encompass methods like
app.Text
. The adjusted function signature would be something likefunc(format string, v ...any)
. Initially, I plan to usefmt.Sprintf
, but my ultimate aim is to introduce a more optimized function for the same results. Your insights on this transition would be incredibly valuable.Replacement of
app.Route(path string, v app.Compo)
Functions with Factory Functionapp.Route(path string, func app.UI)
, Removing Duplicates:The usage of
app.Route(path string, v app.Compo)
functions has raised confusion among many users. In order to streamline and enhance clarity, I'm considering a replacement that involves taking a factory function as an argument, something likeapp.Route(path string, func app.UI)
. This adjustment aims to simplify the process and improve usability while ensuring a consistent approach across routes. As part of this transition, duplicates such asapp.RouteFunc(path string)
will be removed to maintain a clean and efficient API. Your thoughts on this transition are greatly appreciated.Uniformization and Simplification of
app.Handler
Syntax:The evolution of
app.Handler
has led to a growing complexity in both syntax and underlying mechanisms. To achieve API uniformity and simplify this aspect of go-app, I'm contemplating adopting a syntax similar to components. This change aims to enhance consistency while providing a more straightforward approach to usingapp.Handler
.Documentation Relocation:
The influx of documentation-related requests has introduced noise to this repository. To address this and ensure a cleaner environment for issue discussions, I'm considering moving the documentation to a separate repository or adopting a GitHub Wiki-like approach. This change aims to improve the user experience and keep our discussions focused on enhancements and issues.
Your Voice Matters
Your feedback drives the direction of go-app. Please share your thoughts on these proposed changes, offer your opinions, and suggest any alternative ideas you might have.
Thank you for being an integral part of the go-app community. Your contributions and insights fuel our progress. Let's collaborate to make v10 the most remarkable version yet!
I'm eagerly looking forward to hearing from you.
Warm regards,
Maxence
The text was updated successfully, but these errors were encountered: