perf: preload events and CalDAV config to avoid empty screens

Add CaldavConfigStore and preloadAppData() to load events (current month)
and CalDAV config into stores before dismissing the auth loading spinner.
This prevents the brief empty flash when first navigating to Calendar or
Settings tabs. Also applies Prettier formatting across codebase.
This commit is contained in:
2026-02-09 18:59:03 +01:00
parent 0e406e4dca
commit 868e1ba68d
22 changed files with 178 additions and 69 deletions

View File

@@ -25,7 +25,7 @@ export class MongoCaldavRepository implements CaldavRepository {
}
async deleteByUserId(userId: string): Promise<boolean> {
const result = await CaldavConfigModel.findOneAndDelete({userId});
const result = await CaldavConfigModel.findOneAndDelete({ userId });
return result !== null;
}
}

View File

@@ -28,7 +28,10 @@ export class MongoEventRepository implements EventRepository {
return events.map((e) => e.toJSON() as unknown as CalendarEvent);
}
async findByCaldavUUID(userId: string, caldavUUID: string): Promise<CalendarEvent | null> {
async findByCaldavUUID(
userId: string,
caldavUUID: string,
): Promise<CalendarEvent | null> {
const event = await EventModel.findOne({ userId, caldavUUID });
if (!event) return null;
return event.toJSON() as unknown as CalendarEvent;

View File

@@ -2,9 +2,7 @@ import mongoose, { Schema, Document, Model } from "mongoose";
import { CalendarEvent } from "@calchat/shared";
import { IdVirtual } from "./types";
export interface EventDocument
extends Omit<CalendarEvent, "id">,
Document {
export interface EventDocument extends Omit<CalendarEvent, "id">, Document {
toJSON(): CalendarEvent;
}