Keeping TreeView state with component in Go
Jeff Lindsay Oct 19
I came back to the tree view prototype re-implemented in my Go UI framework. It really doesn't behave any differently, but I spent all evening reimplementing it to handle a more React-like data model, where we store authoritative state of the tree in Go with the component, load and save there, and then push that state to the jQuery component.
Then I had to hook up any change that happens in jsTree to reproduce that change in the data model in the Go component, saving, and re-rendering the component, which now just calls some JS to set and refresh jsTree.
Lastly I got localStorage persistence working so it's roughly where it was before, but now I have control over the nodes in Go and can store any extra data on them there instead of hacking jsTree to keep extra data on the nodes.
Following folks on dev.to has always been key to customizing the kind of content you're more likely to see in your feed and notifications, but now that we have DEV Connect I feel like there is even more we can do by following folks with shared interests and willingness to be helpful.