Fix: using node:fs instead of fs

This commit is contained in:
Moyasee
2025-09-29 20:14:36 +03:00
parent bd86321d02
commit a87e04a366
4 changed files with 19 additions and 16 deletions

View File

@@ -59,7 +59,7 @@ const removeGameFromLibrary = async (
}
if (assetPathsToDelete.length > 0) {
const fs = await import("fs");
const fs = await import("node:fs");
for (const assetPath of assetPathsToDelete) {
try {
if (fs.existsSync(assetPath)) {

View File

@@ -58,7 +58,7 @@ const updateCustomGame = async (
}
if (oldAssetPaths.length > 0) {
const fs = await import("fs");
const fs = await import("node:fs");
for (const assetPath of oldAssetPaths) {
try {
if (fs.existsSync(assetPath)) {

View File

@@ -51,14 +51,14 @@ const updateGameCustomAssets = async (
if (existingAssets) {
const updatedAssets = {
...existingAssets,
title,
title,
};
await gamesShopAssetsSublevel.put(gameKey, updatedAssets);
}
if (oldAssetPaths.length > 0) {
const fs = await import("fs");
const fs = await import("node:fs");
for (const assetPath of oldAssetPaths) {
try {
if (fs.existsSync(assetPath)) {

View File

@@ -400,19 +400,22 @@ export function EditGameModal({
};
// Helper function to reset form to initial state
const resetFormToInitialState = useCallback((game: LibraryGame | Game) => {
setGameName(game.title || "");
const resetFormToInitialState = useCallback(
(game: LibraryGame | Game) => {
setGameName(game.title || "");
if (isCustomGame(game)) {
setCustomGameAssets(game);
// Clear default URLs for custom games
setDefaultIconUrl(null);
setDefaultLogoUrl(null);
setDefaultHeroUrl(null);
} else {
setNonCustomGameAssets(game as LibraryGame);
}
}, [setCustomGameAssets, setNonCustomGameAssets]);
if (isCustomGame(game)) {
setCustomGameAssets(game);
// Clear default URLs for custom games
setDefaultIconUrl(null);
setDefaultLogoUrl(null);
setDefaultHeroUrl(null);
} else {
setNonCustomGameAssets(game as LibraryGame);
}
},
[setCustomGameAssets, setNonCustomGameAssets]
);
const handleClose = () => {
if (!isUpdating && game) {