Everything the union does lived inside a Meteor.startup callback with no exports:
the queue, the incremental fast path, the worker-failure handling. None of it was
reachable from a test, which is how three separate incidents shipped — a failed
worker stored as an empty union (50ca9cc), turf deps unresolvable from the worker
(3249362/570cb49) and a recompute that blocked the event loop and froze DDP
(b4e5511/fbb746f). subsUnionLogic.js now takes its collaborators as arguments and
subsUnion.js is only the wiring.
The FIXME at the old subsUnion.js:82 goes with it, because it lives inside the
extracted storeUnion: a union over 16 MiB is simply rejected by Mongo, so the map
would freeze at the last union that happened to fit, silently. unionSizeGuard.js
degrades the geometry instead — coordinate precision, then vertex decimation,
then holes, then the smallest polygons — until it fits, and reports what it did
so the setting document records it. The cap is 8 MiB rather than 16: the same
string is pushed to every browser over DDP.
addNoisy no longer mutates the document it is given, so the public pass cannot
leak its fuzzing into the private one.
11 lines
455 B
JavaScript
11 lines
455 B
JavaScript
/* eslint-disable import/no-absolute-path */
|
|
|
|
// Leaflet is a browser library; the workaround import fakes the bits of `window`
|
|
// it touches at load time so it can also run on the server. Kept apart from
|
|
// subsUnionLogic so that module (and its tests) stay free of that dependency.
|
|
import './leaflet-workaround';
|
|
import L from 'leaflet';
|
|
|
|
const unionBounds = union => (union === null ? null : L.geoJSON(union).getBounds());
|
|
|
|
export default unionBounds;
|