microsoft / microsoft/PowerToys

CmdPal: Bookmark {placeholder} field retains last-entered value on every subsequent open

Open
#50,175 1 comment 0 reactions 0 assignees View on GitHub
Issue-Bug Product-Command Palette
Dominant language
C
Stars
139k
Forks
8.6k
PR merge metrics
PR metrics pending

Description

### Description of the new feature / enhancement

Bug: A Bookmark with a `{placeholder}` in its URL keeps showing the *last value ever entered* pre-filled the next time the bookmark is opened, instead of starting empty. The user has to manually clear the field before typing a new value every time.

### Scenario when this would be used?

Any bookmark that uses `{placeholder}` syntax to build a dynamic URL (e.g. `https://example.com/issue/ABC-{n}`), used repeatedly with different values over time — a very common pattern for jumping to tickets/PRs by number.

### Repro

1. Command Palette → Add a bookmark → URL `https://example.com/issue/ABC-{n}`, name `abc`.
2. Open the bookmark (type `abc`, Enter) → the placeholder form shows an empty field → type `1` → Enter → launches `.../ABC-1`.
3. Open the bookmark again → the field is pre-filled with `1` instead of being empty. Repeat with `2` → next open shows `2`, etc. The field always shows whatever was typed last, every time, indefinitely.

### Root cause (traced in source, `main` branch)

- `BookmarkListItem` (`src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Pages/BookmarkListItem.cs`) builds its `Command` — a `BookmarkPlaceholderPage` holding one `StringParameterRun` per `{placeholder}` — exactly once, in the constructor, via `_classificationGate.ExecuteAsync()`. That only re-runs on an explicit bookmark edit (`Update()`, wired to the `BookmarkUpdated` event), never on merely opening/selecting the bookmark from the list.
- The parameter textbox is one-way bound to that same long-lived `StringParameterRun.Text` (`src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/SearchBar.xaml`, `StringParamTemplate`: `Text="{x:Bind TextForUI, Mode=OneWay}"`).
- Nothing clears `_placeholderRuns` after a successful launch — `BookmarkPlaceholderPage.LaunchWithCurrentValues()` invokes and dismisses (`CommandResult.Dismiss()`) but never resets the parameter values.

Since the `BookmarkPlaceholderPage`/`StringParameterRun` instance is cached for the life of the session rather than rebuilt per-open, whatever was last typed persists in that object and is shown again on every subsequent open.

### Expected behavior

Opening a bookmark's placeholder form should start with empty (or a sensible default) fields each time, not the last-entered value from a previous invocation — unless "remember last value" is an intentional feature, in which case it should be documented/configurable.

### Environment

PowerToys 0.101.2362.0, Command Palette (Microsoft.CommandPalette package), Windows 11.

Contributor guide

Open the contributing guide

Research direction

Start with src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Pages/BookmarkListItem.cs and BookmarkPlaceholderPage.LaunchWithCurrentValues(), then inspect the StringParamTemplate binding in src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/SearchBar.xaml. Verify that reopening a bookmark creates an empty or intentional default placeholder form after a previous launch, while editing a bookmark still updates its command.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.