Closed sylvainpolletvillard closed 6 years ago
@gotjoshua what do you think ? I'm happy with the current design
screenshot looks great! Looking forward to test it out (tomorrow morning i'll have time) Will you push it to npm?
yes I'll publish a new version, probably minor
Mostly perfect... found one thing:
let PlacesOMset=new SetModel([PlaceOM]) let clientSpaceOM = new SpaceOM( { name: 'clientSpacenew', places: new PlacesOMset(normalSet) } ); clientSpaceOM.undecProp='foo' clientSpaceOM.undecArrayWithDups=arrayWithDupObj; clientSpaceOM.undecSetFromArray=normalSet;
i am expecting places to show like your setProp: Set of SpaceOM > but it just shows as places: model and is not expandable:
Ah, you mean expandable model definitions inline inside another parent model definition. It may be possible, but I'm gonna need to rewrite the whole model formatter (currently relying on the toString()
behaviour that expands everything as a String)
ouch. well i don't mean to be demanding, i just thought it would be easy enough because it already works for a normal Set, so why not for an instance of a SetModel...
Also down in the __proto Model - i would expect places: Set of PlaceOM > (that could be expandable or not at that depth)...
But yeah, I meant if a Prop is typed as a SetModel - when I fill that Prop with an instance of a SetModel - i expect that the SetModel will check if all items are instances of the allowed Object Type and i expect to be able to inspect the Set...
And I just notice now that in the __proto, constructor: ought to align to the top with >Model
I'm afraid alignment is not something I can easily control. The custom formatter API is quite limited and very badly documented by Google.
I reused the toString
logic of each model in the formatter to keep the formatter code small and avoid code duplication. But if there is a legitimate reason to customize this logic for the devtools, for example using the expandable structures, I can do that. The code size of the formatter shouldn't be a problem since you are not supposed to ship it in production.
Fully understandable. I consider it a "nice to have" to show the expandable structures - but if I am stuck and need to see it - I can always toggle off the custom formatting for a hot second. So i wouldn't give it high priority.
Further improvements to instance formatter for named models:
Showing assertions in the model formatter:
Expandable submodels, cc @gotjoshua
Latest improvements have been released in v3.5.2 🚀
Goals:
Current progress: