Applies a unit mutation: the change goes to the engine as a DIFF when the layer can be
addressed by id, and as a whole-collection re-feed when it cannot.
features is the array the caller has ALREADY mutated in place — the store's own array,
not a copy. That is the point of the whole path: addFeature on a layer of 100 000 costs
one push and a diff of one, instead of a fresh array of 100 001 and a full
re-serialisation to the worker.
🛑 The fallback lives HERE, not in the adapter, and that is what makes it observable.
Re-feeding needs the whole collection, which this layer holds and the adapter deliberately
does not. Keeping the decision on this side means a unit test with a fake adapter can
assert which of the two paths ran — and a fallback nobody can see fire is a fallback
that quietly becomes the only path, which is how a diff optimisation dies without a
single test turning red.
🛑 A free function, NOT a member of GeoJSONCore — and that is not a style choice.globals.geojson.ts mounts that object wholesale as GeoLeaf.GeoJSON, so a member here
would be public API: typed, documented, frozen by the semver ratchet and owed to
integrators forever, for a seam whose only two callers are in this directory. The boot
golden master caught the first attempt, which is what it is for.
Applies a unit mutation: the change goes to the engine as a DIFF when the layer can be addressed by id, and as a whole-collection re-feed when it cannot.
featuresis the array the caller has ALREADY mutated in place — the store's own array, not a copy. That is the point of the whole path:addFeatureon a layer of 100 000 costs onepushand a diff of one, instead of a fresh array of 100 001 and a full re-serialisation to the worker.🛑 The fallback lives HERE, not in the adapter, and that is what makes it observable. Re-feeding needs the whole collection, which this layer holds and the adapter deliberately does not. Keeping the decision on this side means a unit test with a fake adapter can assert which of the two paths ran — and a fallback nobody can see fire is a fallback that quietly becomes the only path, which is how a diff optimisation dies without a single test turning red.
🛑 A free function, NOT a member of
GeoJSONCore— and that is not a style choice.globals.geojson.tsmounts that object wholesale asGeoLeaf.GeoJSON, so a member here would be public API: typed, documented, frozen by the semver ratchet and owed to integrators forever, for a seam whose only two callers are in this directory. The boot golden master caught the first attempt, which is what it is for.