-
-
Notifications
You must be signed in to change notification settings - Fork 355
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
How to make a cute CRUD table component #926
Comments
Hi, cool that you try go-app :) The problem with your code is that you missed that |
Thanks @oderwat Now I am getting the expected result: I have changed my code as below, but I still can't understand why I am getting the following log message while entering Render function:
it seems the Compo is not initialized yet.
Do you have any plan to extend your library with more standard components? |
I see you use |
It works @oderwat . |
You place one component into another one. The only limitation with that is, that each component must have a root component. So if you had one that are table rows, you need to have the '' as their parent to make it a component that then can co into a |
Thanks @oderwat . |
You can write tests (see go-app test sources). You can actually debug in the browser, but that is not expressive, but I think they work in it. But currently you mostly need to do "app.Log()" or "dbg.Log()" (our package) print debugging. For the problem with recompilation and reloading I wrote an internal tool that for all our go applications including the PWAs handles restarts of services and apps with support for go.work files and other stuff. But that comes down to simply checking for changes and restarting the app server and have a short time update checker in the web application and have that reload. There one "can" store state in local storage and let the app jump into this, so that you do not have to click through all the functionality. You could also write short individual applications that test / demos components. We do this by the same tool which also does the watcher functionality as this can create an app skeleton by just giving it a name. Besides all of this I also experimented in automatic testing through headless chrome witch also works quite well, but we do not utilize that in production yet. I have an older public repo with a proof of concept. We (again internally) have a larger testing framework build on this idea. https://github.com/oderwat/rodgoapp |
Could you please make an example of using app.Log() or dbg.Log() ? |
Also PreRender can be useful for debugging? |
I would I normally just do it like this: func (sc *StudentCompo) OnMount(ctx app.Context) {
dbg.Log()
sc.Students = createStudents()
} or func (sc *StudentCompo) OnMount(ctx app.Context) {
dbg.Log("start")
defer dbg.Log("end")
sc.Students = createStudents()
} Which will automatically show the package and function without writing it out all the time. You also can use:
This is not planned. First of: Releasing anything usually means that you need to support and fully document it. We are too small to handle that. Second: This is magic and the tools name is even You should maybe check out "mage" which was used by us in the past and where I wrote the first automatic re-compiler for. I think https://github.com/oderwat/go-nats-app could be of interest for you (maybe also for the front-/backend communication for which we use NATS nearly exclusively). The actual watcher code could be a variant of run which starts the program in a go routine and then polls the glob patterns for changes, if they occur you kill the process and start over again. Of course there are multiple other things to be taken care of. I once used some other go based file watcher but I don't remember which one and why it was not "good enough" in the end. |
We actually never use |
For debugging the actual WASM I found some good information here: |
Mhh, |
I think that whole diagram is a bit outdated or does not contain the information that is needed (imho). |
Documentation will be revamped. At the begining v10 changed some stuff in terms of ordering but is has been reverted back since you folks were using those things. |
Ok 👌🏻 |
I'm really struggling to deploy my website too, I hope the new doc will improve this part. I tried the static way showed in the current doc but half of my website is broken doing this way. I'm still a bit confused what goes into the "static" part. Everything works fine if I launch a web server on "/" but doing this way I struggle to deploy it on services such as fly.io. |
Hello,
beautiful project, congrats!
Do you have few minutes to give me some hints on how to build a beautiful CRUD table component?
I am testing the following code:
But unfortunately it only prints the header:
The logger prints this:
Do you have any suggestion on how to build this component?
The text was updated successfully, but these errors were encountered: