Currently, they all say [[circular reference]] which is actually usually not even true, they're just objects already seen.
There's basically four reasons an object is hidden:
It's not serializable, in which case it should say [object ObjectType]
The object has already been serialized once (either a circular reference, or just a duplicate one). This is tricky, because e.g. [object hidden] may not be clear - may not be obvious where else in the tree it'll be. Right now, this just is [circular reference], so it should be able to stay that way for v0.1.
It's another entity. It would actually be amazing if this could be a link to elsewhere in the tree, using the entity's ID! This could be formatted as e.g. [entity <uuid>]
It's a coquette namespace, in which case it says [coquette namespace]
1) and 4) should already be working, but 2) and 3) require some way to distinguish between each other so the serializer can set them correctly. I think the solution is to use the value of the entityMap/seen to indicate whether it's a previously serialized object (2), or another entity (3).
Handling
This goes in tandem with the above. One of the tricky bits about this is making sure that these fancy strings with fancy meanings don't end up conflicting with actual set strings, because there's going to be a regex match used against them to ensure that the UI doesn't allow them to be edited.
From the above, I could think of a few regexes to match:
^\[object\s[^\s]*]$ - matches [object Object], not [object], not [object object object]
^[circular reference]$
^[entity \s[^\s]*$ - similar to 1
^[coquette namespace]$
These should probably be in the docs somewhere, as a way of saying "make sure your strings don't match things!"
Labeling
Currently, they all say
[[circular reference]]
which is actually usually not even true, they're just objects already seen.There's basically four reasons an object is hidden:
[object ObjectType]
[object hidden]
may not be clear - may not be obvious where else in the tree it'll be. Right now, this just is[circular reference],
so it should be able to stay that way for v0.1.[entity <uuid>]
[coquette namespace]
1) and 4) should already be working, but 2) and 3) require some way to distinguish between each other so the serializer can set them correctly. I think the solution is to use the value of the
entityMap
/seen
to indicate whether it's a previously serialized object (2), or another entity (3).Handling
This goes in tandem with the above. One of the tricky bits about this is making sure that these fancy strings with fancy meanings don't end up conflicting with actual set strings, because there's going to be a regex match used against them to ensure that the UI doesn't allow them to be edited.
From the above, I could think of a few regexes to match:
^\[object\s[^\s]*]$
- matches[object Object]
, not[object]
, not[object object object]
^[circular reference]$
^[entity \s[^\s]*$
- similar to 1^[coquette namespace]$
These should probably be in the docs somewhere, as a way of saying "make sure your strings don't match things!"