Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ import PerformanceMonitor from "./utils/performance";
import { PING_TIMEOUT_VALUE } from "./utils/query";
import { sc } from "./utils/sizeScaler";

const LOADING_WINDOW_SIZE = new LogicalSize(250, 300);
const DEFAULT_WINDOW_SIZE = new LogicalSize(1000, 700);

// Lazy load heavy components for better initial load time
const MainView = lazy(() => import("./containers/MainBody"));
const NavBar = lazy(() => import("./containers/NavBar"));
Expand Down Expand Up @@ -89,9 +92,18 @@ const App = memo(() => {

mainWindowSize.current = innerSize.toLogical(scaleFactor);

// If the window is already at the loading size (e.g. after a reload),
// do not capture it as the main window size.
if (
mainWindowSize.current.width === LOADING_WINDOW_SIZE.width &&
mainWindowSize.current.height === LOADING_WINDOW_SIZE.height
) {
mainWindowSize.current = DEFAULT_WINDOW_SIZE;
}

// Set window attributes for loading screen
await Promise.all([
appWindow.setSize(new LogicalSize(250, 300)),
appWindow.setSize(LOADING_WINDOW_SIZE),
appWindow.setResizable(false),
appWindow.center(),
]);
Expand Down Expand Up @@ -128,7 +140,7 @@ const App = memo(() => {

useEffect(() => {
if (!loading) {
const targetSize = mainWindowSize.current || new LogicalSize(1000, 700);
const targetSize = mainWindowSize.current || DEFAULT_WINDOW_SIZE;

Promise.all([
appWindow.setResizable(true),
Expand Down
Loading