Skip to content

Commit

Permalink
Fixed: Error when user does not choose migration location (#268)
Browse files Browse the repository at this point in the history
* Hack: Return empty

* Fix test.
  • Loading branch information
robinjhuang authored Nov 16, 2024
1 parent b4f54b1 commit 98db404
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/config/comfyServerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ export class ComfyServerConfig {
public static async getMigrationConfig(
migrationSource?: string,
migrationItemIds: Set<string> = new Set()
): Promise<Record<string, ModelPaths>> {
): Promise<{ comfyui: ModelPaths } & Record<string, ModelPaths>> {
if (!migrationSource || !migrationItemIds.has('models')) {
return {};
return { comfyui: {} };
}
// The yaml file exited in migration source repo.
const migrationServerConfig = await ComfyServerConfig.getConfigFromRepoPath(migrationSource);
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/comfyServerConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ comfyui:
describe('getMigrationConfig', () => {
it('should return empty object when no migration source is provided', async () => {
const result = await ComfyServerConfig.getMigrationConfig(undefined);
expect(result).toEqual({});
expect(result).toEqual({
comfyui: {},
});
});

it('should merge configs and remove custom_nodes when migration source is provided', async () => {
Expand Down

0 comments on commit 98db404

Please sign in to comment.