We have discovered a new pattern in Frontity: Sometimes, some props of the state are defined as “derived”, but can be overwritten by the user.
And sometimes, other parts of the application may want to know if that was the case or not.
The best example is
- By default, it is derived from the value of
- It can be overwritten by the user to
state.source.apiis not a WP.com subdomain but the site is still a WP.com (for personal and premium plans).
As suggested by Michal, something like this could work:
const isDerived = (obj, propName) => typeof Object.getOwnPropertyDescriptor(obj, propName).value === "function";
This means that the API to check if
state.wpSource.isWpCom is derived is:
I don’t think there is a way to make it work with