Skip to content

fix: duplicate folder path when selecting target folder for progress tracks - #640

Merged
zkat merged 1 commit into
iron-vault-plugin:mainfrom
nickarrow:bug-auto-path-duplication-fix
Jan 13, 2026
Merged

zkat merged 1 commit into
iron-vault-plugin:mainfrom
nickarrow:bug-auto-path-duplication-fix

Conversation

@naretakis

Copy link
Copy Markdown
Contributor

closes #639

Description

Problem

When creating a new progress track and selecting a folder from the "Target folder" dropdown, the campaign root folder was being duplicated in the resulting path.

For example, if the campaign folder is campaign1 and the user selects campaign1/Progress from the dropdown, the modal would show:

  • Expected: campaign1/Progress
  • Actual: campaign1/campaign1/Progress

This resulted in entity blocks being created with incorrect underlying paths.

Root Cause

In progress-create.ts, a FolderTextSuggest was being explicitly instantiated on the target folder input element:

const folderSetting = RelativeFolderSearchComponent.addToSetting(
  new Setting(contentEl).setName("Target folder"),
  this.plugin.app,
  (search) => {
    new FolderTextSuggest(this.app, search.inputEl);  // ← Problem here
    folderComponent = search
      // ...
  },
);

However, RelativeFolderSearchComponent already creates its own internal FolderTextSuggest in its constructor. This created two competing suggest components on the same input:

  1. The internal one (correct) - configured with the campaign folder as baseFolder
  2. The extra one (incorrect) - using the vault root as baseFolder (default)

When a user selected a folder from the dropdown, the second suggest component would set the input value as a path relative to the vault root. Then RelativeFolderSearchComponent.onChanged() would join this with the campaign folder, resulting in the duplicated path.

Why This Only Affected Progress Tracks

The change is isolated to progress-create.ts only. Searching through the codebase, no other files seem to have the same duplicate pattern, so there's minimal risk of impacting anything else.

For example, the clock creation modal (clock-create-modal.ts) does not have this extra FolderTextSuggest instantiation. It correctly relies solely on the one provided by RelativeFolderSearchComponent. Similarly, other entity creation flows (like Roll All oracles) use different modal code that doesn't have this issue.

Fix

Removed the redundant FolderTextSuggest instantiation and its now-unused import.

Testing

  • Create a new progress track and select a folder from the Target folder dropdown
  • Verify the path no longer duplicates the campaign root folder
  • Verify typing a folder path manually still works correctly
  • Verify clock and entity creation still works correctly
  • All tests still passing

…rogress track modal

The "New progress track" modal was creating a duplicate FolderTextSuggest
instance on the target folder input element. RelativeFolderSearchComponent
already creates its own internal FolderTextSuggest in its constructor,
so the extra instantiation on line 163 was redundant.

This caused a bug where selecting a folder from the dropdown would result
in the campaign root folder being duplicated in the path (e.g.,
"campaign1/campaign1/Progress" instead of "campaign1/Progress").
@naretakis

Copy link
Copy Markdown
Contributor Author

This little fix is ready for review (I think) @cwegrzyn or @zkat

@zkat
zkat merged commit 5e5b5c3 into iron-vault-plugin:main Jan 13, 2026
4 checks passed
@zkat zkat added the bug Something isn't working label Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Progress Track Target Folder Duplicates Root Folder

3 participants