You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're looking at switching over to mobx-keystone from mobx-state-tree, and one tiny feature we've come to really appreciate in MST is a per-model id generator function. AFAICT, keystone currently supports one global id generator function that is overrideable, but in MST, you can configure the id generator on a per prop basis.
Our use case is putting the type name in the generated ID itself. We use an id prop similar to what keystone has by default, but we are able to do:
where each different model type has an id generator that prefixes the id with the type's name. This is super useful when passing ids around to know what it is actually and id for and to make it easier to detect accidentally passing an identifier for the wrong type. I don't think mobx-keystone needs to do this by default, but being able to customize the generator for each model would be great to let us do this in userland!
The text was updated successfully, but these errors were encountered:
We're looking at switching over to mobx-keystone from mobx-state-tree, and one tiny feature we've come to really appreciate in MST is a per-model id generator function. AFAICT, keystone currently supports one global id generator function that is overrideable, but in MST, you can configure the id generator on a per prop basis.
Our use case is putting the type name in the generated ID itself. We use an id prop similar to what keystone has by default, but we are able to do:
where each different model type has an id generator that prefixes the id with the type's name. This is super useful when passing ids around to know what it is actually and id for and to make it easier to detect accidentally passing an identifier for the wrong type. I don't think mobx-keystone needs to do this by default, but being able to customize the generator for each model would be great to let us do this in userland!
The text was updated successfully, but these errors were encountered: