mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-17 17:07:07 +00:00
perf: reduce startup work and fix grade analytics bar chart animation
Batch settings storage writes, tier plugin startup, lazy-load heavy UI chunks, and optimize global search indexing. Stop tweening bar height in grade analytics to prevent invalid negative SVG rect values. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -131,16 +131,16 @@ const assessmentsOverviewPlugin: Plugin<{}> = {
|
||||
|
||||
if (requestId !== loadRequestId) return;
|
||||
|
||||
renderSkeletonLoader(container);
|
||||
void renderSkeletonLoader(container);
|
||||
|
||||
try {
|
||||
const data = await getAssessmentsData();
|
||||
if (requestId !== loadRequestId) return;
|
||||
renderGrid(container, data);
|
||||
void renderGrid(container, data);
|
||||
} catch (err) {
|
||||
if (requestId !== loadRequestId) return;
|
||||
console.error("Failed to load assessments:", err);
|
||||
renderErrorState(
|
||||
void renderErrorState(
|
||||
container,
|
||||
err instanceof Error ? err.message : "Unknown error",
|
||||
);
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import renderSvelte from "@/interface/main";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import AssessmentsOverview from "./AssessmentsOverview.svelte";
|
||||
import SkeletonLoader from "./SkeletonLoader.svelte";
|
||||
import ErrorState from "./ErrorState.svelte";
|
||||
import { unmount } from "svelte";
|
||||
|
||||
let currentApp: any = null;
|
||||
@@ -119,26 +115,42 @@ function prepareContainer(container: HTMLElement) {
|
||||
watchOverviewTheme(container);
|
||||
}
|
||||
|
||||
export function renderGrid(container: HTMLElement, data: any) {
|
||||
if (currentApp) unmount(currentApp);
|
||||
prepareContainer(container);
|
||||
currentApp = renderSvelte(AssessmentsOverview, container, { data });
|
||||
async function mountOverviewComponent(
|
||||
container: HTMLElement,
|
||||
loader: () => Promise<{ default: any }>,
|
||||
props: Record<string, unknown> = {},
|
||||
) {
|
||||
const [{ default: renderSvelte }, { default: Component }] = await Promise.all([
|
||||
import("@/interface/main"),
|
||||
loader(),
|
||||
]);
|
||||
currentApp = renderSvelte(Component, container, props);
|
||||
}
|
||||
|
||||
export function renderSkeletonLoader(container: HTMLElement) {
|
||||
export async function renderGrid(container: HTMLElement, data: any) {
|
||||
if (currentApp) unmount(currentApp);
|
||||
prepareContainer(container);
|
||||
currentApp = renderSvelte(SkeletonLoader, container);
|
||||
await mountOverviewComponent(container, () => import("./AssessmentsOverview.svelte"), {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export function renderLoadingState(container: HTMLElement) {
|
||||
renderSkeletonLoader(container);
|
||||
}
|
||||
|
||||
export function renderErrorState(container: HTMLElement, error: string) {
|
||||
export async function renderSkeletonLoader(container: HTMLElement) {
|
||||
if (currentApp) unmount(currentApp);
|
||||
prepareContainer(container);
|
||||
currentApp = renderSvelte(ErrorState, container, { error });
|
||||
await mountOverviewComponent(container, () => import("./SkeletonLoader.svelte"));
|
||||
}
|
||||
|
||||
export async function renderLoadingState(container: HTMLElement) {
|
||||
await renderSkeletonLoader(container);
|
||||
}
|
||||
|
||||
export async function renderErrorState(container: HTMLElement, error: string) {
|
||||
if (currentApp) unmount(currentApp);
|
||||
prepareContainer(container);
|
||||
await mountOverviewComponent(container, () => import("./ErrorState.svelte"), {
|
||||
error,
|
||||
});
|
||||
}
|
||||
|
||||
export function teardownOverviewUi() {
|
||||
|
||||
Reference in New Issue
Block a user