mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 16:52:20 +00:00
Fix Data Library share restore, dense tile layers and EPC partition reads
- Share links: the compact /share/<code> format carries the switched-on library entries (field 29), so Copy Link keeps them; a share opened in the same tab restores them; any share decides what is on, so one with every library entry off no longer switches on the recipient's stored entries. - A tile entry too dense at its minimum zoom (Norway cadastre z14, depth z11) is hidden below that scale via minimumTerrainLevel instead of allocating millions of tiles when zoomed out. - EPC partitions keep the full extent for exclusion and the 98 % extent for ranking only; the old trimmed-only extents are retired. - Partition index footers that fail transiently are retried; an incomplete index is never cached as complete, a complete prior index is kept, and it is rebuilt after five minutes. - Views that leave touching partitions unread are partial; listing and footer bodies are capped and ranges validated. - The Browse dialog relabels after a language switch.
This commit is contained in:
1 parent
871b7f0fcc
commit
24ccdd4dc3
20 files changed
+1220
-162
No files matched your search
@@ -207,6 +207,115 @@ test('a link decides what is on and adds its entries to the library', async (t)
|
||||
});
|
||||
});
|
||||
|
||||
/** A ShareLinkManager stand-in: the opening share and in-tab navigation. */
|
||||
function fakeShareLink(initialLibraryTokens) {
|
||||
const link = {
|
||||
initialLibraryTokens,
|
||||
listener: null,
|
||||
setLibraryShareListener(listener) {
|
||||
link.listener = listener;
|
||||
},
|
||||
setLibraryParamsEncoder() {},
|
||||
onLibraryStateChange() {},
|
||||
};
|
||||
return link;
|
||||
}
|
||||
|
||||
test('a share with every library entry off keeps the stored ones off', async (t) => {
|
||||
const manager = sealedManager(t);
|
||||
const storage = memoryStorage(
|
||||
JSON.stringify({
|
||||
added: ['night-lights', 'sea-marks'],
|
||||
on: ['night-lights', 'sea-marks'],
|
||||
}),
|
||||
);
|
||||
// A compact /share/<code> link with no library field, and a long-form link
|
||||
// with no lib=: both are shares that switch no library entry on.
|
||||
for (const options of [
|
||||
{ shareLink: fakeShareLink([]) },
|
||||
{ initialHash: '#lat=1&lon=2&l=' },
|
||||
]) {
|
||||
const library = createDataLibrary({
|
||||
entries,
|
||||
ledger,
|
||||
dataManager: manager,
|
||||
services: {},
|
||||
storage,
|
||||
source: source({}),
|
||||
...options,
|
||||
});
|
||||
await library.start();
|
||||
assert.equal(manager.isEnabled('lib-night-lights'), false);
|
||||
assert.equal(manager.isEnabled('lib-sea-marks'), false);
|
||||
// The recipient's entries stay in their panel, off.
|
||||
assert.deepEqual(
|
||||
library
|
||||
.list()
|
||||
.filter((row) => row.added)
|
||||
.map((row) => row.entry.id),
|
||||
['night-lights', 'sea-marks'],
|
||||
);
|
||||
library.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
test('the opening share link restores its library tokens', async (t) => {
|
||||
const manager = sealedManager(t);
|
||||
const storage = memoryStorage(
|
||||
JSON.stringify({ added: ['night-lights'], on: ['night-lights'] }),
|
||||
);
|
||||
const library = createDataLibrary({
|
||||
entries,
|
||||
ledger,
|
||||
dataManager: manager,
|
||||
services: {},
|
||||
storage,
|
||||
shareLink: fakeShareLink(['01']),
|
||||
source: source({}),
|
||||
});
|
||||
await library.start();
|
||||
await manager.waitForLayerSettled?.('lib-sea-marks');
|
||||
assert.equal(manager.isEnabled('lib-sea-marks'), true);
|
||||
assert.equal(manager.isEnabled('lib-night-lights'), false);
|
||||
});
|
||||
|
||||
test('navigating between shares switches library entries on and off', async (t) => {
|
||||
const manager = sealedManager(t);
|
||||
const shareLink = fakeShareLink(['00']);
|
||||
const library = createDataLibrary({
|
||||
entries,
|
||||
ledger,
|
||||
dataManager: manager,
|
||||
services: {},
|
||||
storage: memoryStorage(),
|
||||
shareLink,
|
||||
source: source({}),
|
||||
});
|
||||
// A share navigated to before availability loads waits for it and wins.
|
||||
const started = library.start();
|
||||
shareLink.listener(['01']);
|
||||
await started;
|
||||
const settle = () =>
|
||||
Promise.all(
|
||||
['lib-night-lights', 'lib-sea-marks'].map((id) =>
|
||||
manager.waitForLayerSettled?.(id),
|
||||
),
|
||||
);
|
||||
await settle();
|
||||
assert.equal(manager.isEnabled('lib-sea-marks'), true);
|
||||
assert.equal(manager.isEnabled('lib-night-lights'), false);
|
||||
shareLink.listener(['00']);
|
||||
await settle();
|
||||
assert.equal(manager.isEnabled('lib-night-lights'), true);
|
||||
assert.equal(manager.isEnabled('lib-sea-marks'), false);
|
||||
shareLink.listener([]);
|
||||
await settle();
|
||||
assert.equal(manager.isEnabled('lib-night-lights'), false);
|
||||
assert.equal(manager.isEnabled('lib-sea-marks'), false);
|
||||
library.destroy();
|
||||
assert.equal(shareLink.listener, null);
|
||||
});
|
||||
|
||||
test('zoom flies to an added layer through the caller, reset removes everything', async (t) => {
|
||||
const manager = sealedManager(t);
|
||||
const storage = memoryStorage();
|
||||
|
||||
Reference in new issue
Block a user