Merge pull request #1465 from hydralauncher/fix/lazy-loading-messing-up-custom-css

fix: lazy loading messing up custom css
This commit is contained in:
Zamitto 2025-02-19 18:40:37 -03:00 committed by GitHub
commit 260a11ba6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 36 additions and 52 deletions

View file

@ -1,5 +1,9 @@
name: Build name: Build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: pull_request on: pull_request
jobs: jobs:

View file

@ -1,5 +1,9 @@
name: Lint name: Lint
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: pull_request on: pull_request
jobs: jobs:

View file

@ -1,5 +1,9 @@
name: Release name: Release
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: on:
push: push:
branches: main branches: main

View file

@ -1,6 +1,6 @@
{ {
"name": "hydralauncher", "name": "hydralauncher",
"version": "3.2.1", "version": "3.2.2",
"description": "Hydra", "description": "Hydra",
"main": "./out/main/index.js", "main": "./out/main/index.js",
"author": "Los Broxas", "author": "Los Broxas",

View file

@ -263,9 +263,7 @@ export function App() {
useEffect(() => { useEffect(() => {
const unsubscribe = window.electron.onCssInjected((cssString) => { const unsubscribe = window.electron.onCssInjected((cssString) => {
if (cssString) {
injectCustomCss(cssString); injectCustomCss(cssString);
}
}); });
return () => unsubscribe(); return () => unsubscribe();

View file

@ -6,7 +6,10 @@ export interface BackdropProps {
children: React.ReactNode; children: React.ReactNode;
} }
export function Backdrop({ isClosing = false, children }: BackdropProps) { export function Backdrop({
isClosing = false,
children,
}: Readonly<BackdropProps>) {
return ( return (
<div <div
className={cn("backdrop", { className={cn("backdrop", {

View file

@ -15,7 +15,7 @@ export function Button({
theme = "primary", theme = "primary",
className, className,
...props ...props
}: ButtonProps) { }: Readonly<ButtonProps>) {
return ( return (
<button <button
type="button" type="button"

View file

@ -18,26 +18,17 @@ import { store } from "./store";
import resources from "@locales"; import resources from "@locales";
import { SuspenseWrapper } from "./components";
import { logger } from "./logger"; import { logger } from "./logger";
import { addCookieInterceptor } from "./cookies"; import { addCookieInterceptor } from "./cookies";
const Home = React.lazy(() => import("./pages/home/home"));
const GameDetails = React.lazy(
() => import("./pages/game-details/game-details")
);
const Downloads = React.lazy(() => import("./pages/downloads/downloads"));
const Settings = React.lazy(() => import("./pages/settings/settings"));
const Catalogue = React.lazy(() => import("./pages/catalogue/catalogue"));
const Profile = React.lazy(() => import("./pages/profile/profile"));
const Achievements = React.lazy(
() => import("./pages/achievements/achievements")
);
const ThemeEditor = React.lazy(
() => import("./pages/theme-editor/theme-editor")
);
import * as Sentry from "@sentry/react"; import * as Sentry from "@sentry/react";
import Catalogue from "./pages/catalogue/catalogue";
import Home from "./pages/home/home";
import Downloads from "./pages/downloads/downloads";
import GameDetails from "./pages/game-details/game-details";
import Settings from "./pages/settings/settings";
import Profile from "./pages/profile/profile";
import Achievements from "./pages/achievements/achievements";
import ThemeEditor from "./pages/theme-editor/theme-editor";
Sentry.init({ Sentry.init({
dsn: import.meta.env.RENDERER_VITE_SENTRY_DSN, dsn: import.meta.env.RENDERER_VITE_SENTRY_DSN,
@ -82,37 +73,16 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
<HashRouter> <HashRouter>
<Routes> <Routes>
<Route element={<App />}> <Route element={<App />}>
<Route path="/" element={<SuspenseWrapper Component={Home} />} /> <Route path="/" element={<Home />} />
<Route <Route path="/catalogue" element={<Catalogue />} />
path="/catalogue" <Route path="/downloads" element={<Downloads />} />
element={<SuspenseWrapper Component={Catalogue} />} <Route path="/game/:shop/:objectId" element={<GameDetails />} />
/> <Route path="/settings" element={<Settings />} />
<Route <Route path="/profile/:userId" element={<Profile />} />
path="/downloads" <Route path="/achievements" element={<Achievements />} />
element={<SuspenseWrapper Component={Downloads} />}
/>
<Route
path="/game/:shop/:objectId"
element={<SuspenseWrapper Component={GameDetails} />}
/>
<Route
path="/settings"
element={<SuspenseWrapper Component={Settings} />}
/>
<Route
path="/profile/:userId"
element={<SuspenseWrapper Component={Profile} />}
/>
<Route
path="/achievements"
element={<SuspenseWrapper Component={Achievements} />}
/>
</Route> </Route>
<Route <Route path="/theme-editor" element={<ThemeEditor />} />
path="/theme-editor"
element={<SuspenseWrapper Component={ThemeEditor} />}
/>
</Routes> </Routes>
</HashRouter> </HashRouter>
</Provider> </Provider>

View file

@ -110,6 +110,7 @@ export function SettingsAppearance({
onClose={() => { onClose={() => {
setIsImportThemeModalVisible(false); setIsImportThemeModalVisible(false);
clearTheme(); clearTheme();
setHasShownModal(false);
}} }}
onThemeImported={onThemeImported} onThemeImported={onThemeImported}
themeName={importTheme.theme} themeName={importTheme.theme}