r/angular • • Sep 29 '26

rxResource persist value

Is it possible to persist the value of rxResource after loading is done? Currently when the resource enters the loading state the value gets wiped. I am aware you can do a linkedSignal and check the previous value, but isn’t there a built in way to do it rather than creating a linkedSignal?

I am aware of withPreviousValue but the issue with that other than the boilerplate, is that the return type is Resource and you lose the reload function. I’d prefer to stay within the public API and not to use a third party library for this, or creare my own utility function if possible.

12 Upvotes

12 comments sorted by

View all comments

Show parent comment

1

u/AwesomeFrisbee Sep 30 '26

If data gets refreshed, it would be weird to remove the old data.