Skip to content

How to support my own Property Wrapper(s) inside ObservableState? #3016

Answered by lukeredpath
danthorpe asked this question in Q&A
Discussion options

You must be logged in to vote

I had to tackle this problem - we also have a @Loadable property wrapper that does a very similar thing to yours.

I solved this by introducing a separate property wrapper called @ObservedLoadable that supports observation - both property wrappers use the same underlying LoadableState type and supporting reducers/APIs, but the @ObservedLoadable does its own observation tracking internally.

The only catch is because @ObservableState does not know about this macro, you need to also explicitly mark the property as @ObservationStateIgnored - it would be nice if the macro supported a way of declaring other macros to be ignored.

Making @ObservedLoadable work was actually quite straightforward - …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@danthorpe
Comment options

Answer selected by danthorpe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants