xh / hoist-react

🏗️ ⚛️ The XH Hoist toolkit for React
https://xh.io
Apache License 2.0
24 stars 9 forks source link

Add `toJSON()` to `Filter` base class, implement or throw within `FunctionFilter` #3812

Open amcclain opened 1 month ago

amcclain commented 1 month ago

We can't actually serialize a function filter, but having toJSON() on the base class would be helpful and avoid cheats like:

https://github.com/xh/hoist-react/blob/c202046fa32d2f112d4ad5de8621c634634dce4b/data/filter/CompoundFilter.ts#L51

which could then throw in an unhandled way.

Should we implement something human-readable, even if it could not be parsed back?