On initial page load, the server model data gets serialized into a data bundle, to be sent to the client in the response HTML.
During this process, stripComputed removes the outputs of ref lists and reactive functions, to reduce bundle size by locally deleting duplicated data that can be easily reconstructed on the client.
As it turns out, normal refs' outputs weren't getting stripped. I presume it wasn't done because, for the current implementation of the cleanup, the deletion of a local ref pointing to a remote (DB-backed) doc would've caused the remote doc to get deleted.
Changes
This PR adds the stripping of ref outputs in the initial data bundle, by using a new internal _delNoDereference that does a purely local delete, not following the ref. That avoids the problem of inadvertently deleting a remote doc during stripComputed.
Background
On initial page load, the server model data gets serialized into a data bundle, to be sent to the client in the response HTML.
During this process,
stripComputed
removes the outputs of ref lists and reactive functions, to reduce bundle size by locally deleting duplicated data that can be easily reconstructed on the client.As it turns out, normal refs' outputs weren't getting stripped. I presume it wasn't done because, for the current implementation of the cleanup, the deletion of a local ref pointing to a remote (DB-backed) doc would've caused the remote doc to get deleted.
Changes
This PR adds the stripping of ref outputs in the initial data bundle, by using a new internal
_delNoDereference
that does a purely local delete, not following the ref. That avoids the problem of inadvertently deleting a remote doc duringstripComputed
.