Preventing an event to pass through if one of its property was modified

Bonjour bonjour

I have an application that has an ApplicationModel that’s distributed to various places of my app as a Channel<ApplicationModel>. I’m saving this model to a pin so that I don’t have to serialize to disk. This is super trivial thanks to the SaveToModelPin node

image

Thing is, my model has a bunch of properties that I don’t want/need to save. Some might change very often, and I don’t want to trigger a Serialize (inside SaveToModelPin) every time that occurs. Let’s call those Foo and Bar.

I’m looking for a way to prevent the event from going to SaveToModelPin if Foo and Bar have changed.

I asked ChatGPT about this, and it pointed me to using the Scan operator that I have absolutely no clue how to use.

Is there a reactive wizard out there that could shed some light?

Merci beaucoup

One idea that comes immediately is to use the “Author” field. But maybe we’re talking about something like “Where” node?

But can you provide example with SaveToModelPIn?
It’s very interesting concept

ModelTest.vl (23.8 KB)

Some time ago I made such a prototype, with which I have already written some very useful tools. I don’t know how relevant this is to the topic of this thread, but I really hope that the appearance of nodes related to this topic is related to my suggestion.

Are you storing your application model in a class or record? Or is this some new concept in Gamma itself - a global model?

I found it optimal to use Record with a global channel. Then the immutable data type gives the possibility to know whether the object has changed or not in each case of change. Yes, in this case the object changes always when even one comma changes, which can be very inconvenient in such cases when you need to track only one value (I think, it also introduces overhead in the case of a massive model - immutability will burden the garbage collector in the case of rapidly changing data). It is also quite inconvenient if you decide to save the state immediately to the hard disk after the change. In such a case, I don’t save the state to the hard disk, but make “project files” which are just saved states - saved manually or timed after the last change.

On the other hand, storing the state in a class (kind of optimal way) makes it impossible to keep track of changes to the object and then I have to add an additional entity in the form of “changed” and make sure that it is checked and set in the right place.

UPD: I figured out how to work with the SaveToModelPin node. It is interesting, but it works only with Class. I think the best way to use it is to use the Author field

I understand the difference, but maybe something like this would work?

ModelRND1.vl (37.3 KB)