Skip to content

Conversation

@ewrayjohnson
Copy link

What was broken: Clicking “Download” in the preview modal navigated the main window to the file URL (e.g., [/undefined/...)), breaking the app instead of triggering a download. The main toolbar download worked because it used the host’s [onDownload]; the preview bypassed it.
Why it happened: The preview download handler called [window.location.href = filePath], forcing full-page navigation and skipping the host download pipeline.
Secondary issue caught during build: Duplicate [hidden] keys in the context menu config caused a build error.
Fix: Delegate preview downloads to the host [onDownload] via [SelectionContext] and consolidate the [hidden]condition into one boolean.
Result: Preview download now behaves like the main download button—no navigation, host-controlled download; build error removed.

@Saifullah-dev
Copy link
Owner

Saifullah-dev commented Dec 29, 2025

@ewrayjohnson The navigation to an undefined/<filePath> URL happens when the filePreviewPath prop isn’t provided to the FileManager component.

That said, delegating preview downloads to the host via the onDownload callback is a much better and more consistent approach, as it aligns the preview modal behavior with the main download action and avoids full-page navigation.

I’m approving this PR — thanks for the contribution! 🙌
Please also add an entry to CHANGELOG.md so existing users are aware of this behavior change.
Make this commit with semantic release format to publish these changes to npm.

@Saifullah-dev Saifullah-dev merged commit b2affb3 into Saifullah-dev:main Dec 29, 2025
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