Polygon Drawing Tool Misunderstood Behaviour

I am modifying the polygon drawing tool example. I have a question/concern.

If one draws a polygon/polyline the size element is not set and therefore is not present in the saved json.

    { "position": "0 0",
  "model": { "class": "go.GraphLinksModel",
  "nodeDataArray": [ {"loc":"183 148", "geo":"F M0 145 L75 2 L131 87 L195 0 L249 143z", "key":-1} ],
  "linkDataArray": [  ]
} }

Resize the created object with the resizing tool and the resulting json is:

    { "position": "0 0",
  "model": { "class": "go.GraphLinksModel",
  "nodeDataArray": [ {"loc":"194 153", "geo":"F M0 145 L75 2 L131 87 L195 0 L249 143z", "key":-1, "size":"271 155"} ],
  "linkDataArray": []} }

I am persisting to a database that returns the size field as null in the first case. This produces two different results. The first of which can be demonstrated in the Polygon Drawing Tool by setting the size field to null;

    { "position": "0 0",
  "model": { "class": "go.GraphLinksModel",
  "nodeDataArray": [ {"loc":"194 153", "geo":"F M0 145 L75 2 L131 87 L195 0 L249 143z", "key":-1, "size":null } ],
  "linkDataArray": []} }

This produces an appearantly empty drawing. Which one might expect. Maybe…

The second result that is occurring in my code produces this error and call stack:

Uncaught Error: Geometry.scale:x is not in the range scale must be non-zero: 0w.l @ go-debug.js:28w.ja @ go-debug.js:30sd.scale.sd.scale @ go-debug.js:242Y.kp @ go-debug.js:1192Yh @ go-debug.js:948f.kp @ go-debug.js:1064Yh @ go-debug.js:948mj @ go-debug.js:734Mg @ go-debug.js:731z.maybeUpdate.z.mf @ go-debug.js:730(anonymous function) @ go-debug.js:730

I have worked around this by deleting the null size element from the returned json before handing off to the theDiagram.model = go.Model.fromJson(json); function.

So to my question. Why is the size field not always set/present/not null? Am I missing something or doing something that will bite me later?

You could try setting that property on the archetypePartData.

Does not the entity have a size? It appears to know how to redraw itself but I can’t figure out how/where the size data is maintained.

Well, by default the size is implied by the Geometry that the Shape has.

But if the user resizes the Shape (via the ResizingTool), it will get a different GraphObject.desiredSize.