Skip to content

fix(RenameFile): prevent scene title freezing on Next navigation#733

Draft
garfolino wants to merge 1 commit into
stashapp:mainfrom
garfolino:fix/renamefile-title-stuck
Draft

fix(RenameFile): prevent scene title freezing on Next navigation#733
garfolino wants to merge 1 commit into
stashapp:mainfrom
garfolino:fix/renamefile-title-stuck

Conversation

@garfolino

Copy link
Copy Markdown

Problem

When the RenameFile plugin is active on a scene detail page, pressing Next to navigate to another scene leaves the previous scene's title displayed. Every other field updates correctly; only the title is frozen. Disabling the plugin restores normal behavior.

Root cause: The scene title is rendered by a React-controlled TruncatedText component. wrapElement() replaced its contents with an <a> element via element.innerHTML = '', which detaches the text node React tracks. On navigation, React writes the new title into that now-orphaned node, so the visible title never updates. This is a DOM-ownership conflict, not a caching issue (reproduces across browsers).

Solution

Stop restructuring React's DOM. Instead:

  • Event delegation — a single document-level click listener resolves the title via event.target.closest('.scene-header div.TruncatedText') and reads the text at click time. React renders/updates the title freely; we never touch its structure.
  • Non-destructive affordance — the .renamefile class and tooltip are applied via classList.add / setAttribute only (no child mutation), so React's text node stays intact.
  • CSS.renamefile now uses cursor: pointer + hover underline on the title element itself.

All four interaction modes (click / Ctrl / Shift / Alt) are preserved through the unchanged AppendTitleField.

Version bumped 1.0.01.0.1.

🤖 Generated with Claude Code

The scene title is rendered by a React-controlled TruncatedText component.
The plugin replaced its contents with an <a> element (innerHTML = ''),
which detached the text node React updates. Navigating to another scene
with Next then left the previous title displayed while every other field
updated.

Switch to event delegation: a single document-level click listener reads
the title at click time, so React's DOM is never restructured. The styling
class and tooltip are now applied non-destructively (attributes only).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@discourse-stashapp

Copy link
Copy Markdown

This pull request has been mentioned on Stash Forum. There might be relevant details there:

https://discourse.stashapp.cc/t/renamefile/1334/5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants