TDD,E2E 개선, 미적용 스타일 개선
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import type { Block } from "@/features/editor/state/editorStore";
|
||||
|
||||
interface PublicProjectSnapshot {
|
||||
slug: string;
|
||||
title: string;
|
||||
contentJson: Block[];
|
||||
}
|
||||
|
||||
function getStore(): Map<string, PublicProjectSnapshot> {
|
||||
const g = globalThis as any;
|
||||
if (!g.__PB_PUBLIC_PROJECTS) {
|
||||
g.__PB_PUBLIC_PROJECTS = new Map<string, PublicProjectSnapshot>();
|
||||
}
|
||||
return g.__PB_PUBLIC_PROJECTS as Map<string, PublicProjectSnapshot>;
|
||||
}
|
||||
|
||||
export function cachePublicProject(snapshot: PublicProjectSnapshot): void {
|
||||
const store = getStore();
|
||||
store.set(snapshot.slug, snapshot);
|
||||
}
|
||||
|
||||
export function getCachedPublicProject(slug: string): PublicProjectSnapshot | null {
|
||||
const store = getStore();
|
||||
return store.get(slug) ?? null;
|
||||
}
|
||||
Reference in New Issue
Block a user