fix: don't fetch unused cache, FF fixes
parent
cf072e2be0
commit
800041825e
|
@ -54,7 +54,12 @@ export class DeclarationDataCenter {
|
||||||
);
|
);
|
||||||
|
|
||||||
// try to use cache first
|
// try to use cache first
|
||||||
const data = await fetchCachedDeclarationData().catch(_e => null);
|
// TODO: This API is not thought 100% through. If we have a DB cached
|
||||||
|
// already it will not even ask the remote for a new one so we end up
|
||||||
|
// with outdated declaration-data. This has to have some form of cache
|
||||||
|
// invalidation: https://github.com/leanprover/doc-gen4/issues/133
|
||||||
|
// const data = await fetchCachedDeclarationData().catch(_e => null);
|
||||||
|
const data = null;
|
||||||
if (data) {
|
if (data) {
|
||||||
// if data is defined, use the cached one.
|
// if data is defined, use the cached one.
|
||||||
return new DeclarationDataCenter(data);
|
return new DeclarationDataCenter(data);
|
||||||
|
@ -258,12 +263,7 @@ async function fetchCachedDeclarationData() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let transactionRequest = store.get(CACHE_DB_KEY);
|
let transactionRequest = store.get(CACHE_DB_KEY);
|
||||||
transactionRequest.onsuccess = function (event) {
|
transactionRequest.onsuccess = function (event) {
|
||||||
// TODO: This API is not thought 100% through. If we have a DB cached
|
resolve(event.target.result);
|
||||||
// already it will not even ask the remote for a new one so we end up
|
|
||||||
// with outdated declaration-data. This has to have some form of cache
|
|
||||||
// invalidation: https://github.com/leanprover/doc-gen4/issues/133
|
|
||||||
//resolve(event.target.result);
|
|
||||||
resolve(undefined);
|
|
||||||
};
|
};
|
||||||
transactionRequest.onerror = function (event) {
|
transactionRequest.onerror = function (event) {
|
||||||
reject(new Error(`fail to store declaration data`));
|
reject(new Error(`fail to store declaration data`));
|
||||||
|
|
|
@ -49,7 +49,7 @@ const queryParams = new Map(
|
||||||
const fragmentPaths = fragment?.split(LEAN_FRIENDLY_SLASH_SEPARATOR) ?? [];
|
const fragmentPaths = fragment?.split(LEAN_FRIENDLY_SLASH_SEPARATOR) ?? [];
|
||||||
|
|
||||||
const encodedPattern = queryParams.get("pattern") ?? fragmentPaths[1]; // if first fail then second, may be undefined
|
const encodedPattern = queryParams.get("pattern") ?? fragmentPaths[1]; // if first fail then second, may be undefined
|
||||||
const pattern = decodeURIComponent(encodedPattern);
|
const pattern = encodedPattern && decodeURIComponent(encodedPattern);
|
||||||
const strict = (queryParams.get("strict") ?? "true") === "true"; // default to true
|
const strict = (queryParams.get("strict") ?? "true") === "true"; // default to true
|
||||||
const view = fragmentPaths[0];
|
const view = fragmentPaths[0];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue