Skip to content

Commit

Permalink
Fix: assets not being deleted correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Zyie committed May 15, 2024
1 parent 57c3bc6 commit 0ae2167
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/core/Asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export class Asset
this.children.splice(index, 1);
asset.parent = null;
}

asset.releaseChildrenBuffers();
}

addTransformChild(asset: Asset)
Expand Down
2 changes: 1 addition & 1 deletion src/core/AssetPack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class AssetPack
}
}

async function deleteAsset(asset: Asset)
export async function deleteAsset(asset: Asset)
{
asset.transformChildren.forEach((child) =>
{
Expand Down
2 changes: 2 additions & 0 deletions src/core/AssetWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import chokidar from 'chokidar';
import fs from 'fs-extra';
import { Asset } from './Asset.js';
import { AssetIgnore } from './AssetIgnore.js';
import { deleteAsset } from './AssetPack.js';
import { Logger } from './logger/Logger.js';
import { applySettingToAsset } from './utils/applySettingToAsset.js';
import { path } from './utils/path.js';
Expand Down Expand Up @@ -222,6 +223,7 @@ export class AssetWatcher
else if (asset.state === 'normal')
{
asset.state = 'modified';
deleteAsset(asset);
}

// flag all folders as modified..
Expand Down
2 changes: 2 additions & 0 deletions src/manifest/pixiManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ function collectAssets(
)
{
if (asset.skip) return;
// an item may have been deleted, so we don't want to add it to the manifest!
if (asset.state === 'deleted') return;

let localBundle = bundle;

Expand Down

0 comments on commit 0ae2167

Please sign in to comment.