quarrant / mobx-persist-store

Persist and rehydrate observable properties in mobx store.
268 stars 14 forks source link

Suggestion: Only warn with `(...) is an action and will not persist` in dev (verbose) mode #107

Open ThaJay opened 1 year ago

ThaJay commented 1 year ago

Perhaps I have misunderstood, and in that case I would love to be enlightened, but It seems expected behaviour that actions are not persisted as mentioned in the docs.

At the moment, many of the actions in our project are arrow functions, so they are class properties instead of methods. I have given the properties config of Object.keys(this) because I do not want to manually name dozens of properties on dozens of stores and then maintain those lists and the docs state properties to be a required config. It would be nice to have this config optional and have it take Object.keys(this) by default, but that is fine by me because the end-user will never see this.

The console warnings though, I can not easily get rid of without explicitly ignoring them.

What are your thoughts and feelings about this issue?

quarrant commented 10 months ago

Hello and thank for the question!

Try to use something like this Object.keys(this).filter((it) => typeof this[it] !== 'function') because your problem is not about library. The main approach is using named properties in configuration