This commit is contained in:
undefined committed 2024-07-16 13:51:44 +08:00
1 parent 60072e5747
commit 63cf9b609a
3 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.52.0", "version": "4.52.1",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "index.ts", "main": "index.ts",
@@ -262,9 +262,9 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
} }
async function loadAns() { async function loadAns() {
const saved = await db.get('solutions', `${cacheKey}#objective`); const saved = await db.get('solutions', `${cacheKey}#objective`);
if (!saved) return; if (typeof saved?.value !== 'string') return;
const isValidOption = (v) => v.length === 1 && v.charCodeAt(0) >= 65 && v.charCodeAt(0) <= 90; const isValidOption = (v) => v.length === 1 && v.charCodeAt(0) >= 65 && v.charCodeAt(0) <= 90;
Object.assign(ans, JSON.parse(saved)); Object.assign(ans, JSON.parse(saved?.value || '{}'));
for (const [id, val] of Object.entries(ans)) { for (const [id, val] of Object.entries(ans)) {
if (Array.isArray(val)) { if (Array.isArray(val)) {
for (const v of val) { for (const v of val) {
+1 -1
View File
@@ -11,7 +11,7 @@ export const openDB = _open('hydro', 1, {
for (const key of keys) { for (const key of keys) {
if (key.endsWith('#objective')) { if (key.endsWith('#objective')) {
const value = localStorage.getItem(key); const value = localStorage.getItem(key);
if (value) solutionStore.put({ id: key, value: JSON.parse(value) }); if (value) solutionStore.put({ id: key, value });
localStorage.removeItem(key); localStorage.removeItem(key);
} }
if (key.startsWith('scoreboard-star/')) localStorage.removeItem(key); if (key.startsWith('scoreboard-star/')) localStorage.removeItem(key);