yznts / kyoto

Asynchronous frontends with Go
https://pkg.go.dev/github.com/yznts/kyoto/v3
MIT License
651 stars 28 forks source link

Make an option to disable specific state variables from serialization #120

Closed yznts closed 2 years ago

yznts commented 2 years ago

In the old, struct first approach, we had an option to disable serialization for specific variables with json:"-" tag. This can help drastically improve performance with decreasing payloads size. In the new state wrapper we don't have such option. Need to bring a solution for this.

yznts commented 2 years ago

As an option we can use the same scheme as Go uses - ignore lowercase fields. We are passing map as a component state, so we will not get an access error in templates while referencing this fields. Previously, with structs, we couldn't use this approach because template can't reference private struct fields.

yznts commented 2 years ago

It was decided to use private: preffix instead