feat: Update API versioning and parser handling for improved schedule updates and error management
This commit is contained in:
@@ -15,12 +15,15 @@ export function namesGroup(fileName, group) {
|
||||
}
|
||||
|
||||
/**
|
||||
* changed: the same document was republished (or parsed by an older version) — reload it quietly.
|
||||
* changed: the same document was republished, or parsed by an older parser than the server's
|
||||
* (`catalog.parserVersion`, from API version 10) — reload it quietly.
|
||||
* newer: another document for this group appeared later, e.g. the next semester — offer it.
|
||||
* missing: the document left the catalog, e.g. a new academic year began.
|
||||
*/
|
||||
export function scheduleUpdate(saved, catalog, group, options = {}) {
|
||||
const { dismissed = [], schemaVersion = 0 } = options;
|
||||
// A server without parserVersion never asks for a re-read: comparing with a guess could
|
||||
// reload the same document on every check.
|
||||
const { dismissed = [], schemaVersion = catalog?.parserVersion ?? 0 } = options;
|
||||
const fileId = saved?.source?.fileId;
|
||||
if (!fileId || !catalog?.files || catalog.stale) return null;
|
||||
const current = catalog.files.find((f) => f.id === fileId) || null;
|
||||
|
||||
Reference in New Issue
Block a user