Skip to content

Fix .docx file crash#3413

Merged
tzarebczan merged 1 commit intomasterfrom
fix-docx-crash
Feb 6, 2026
Merged

Fix .docx file crash#3413
tzarebczan merged 1 commit intomasterfrom
fix-docx-crash

Conversation

@keikari
Copy link
Contributor

@keikari keikari commented Feb 6, 2026

This was crashing, due to DocxViewer only being imported on the desktop App.
But importing it on web doesn't seem to work.
This change defaults .docx to render in the Download only view

https://odysee.com/@Dimitar:6/On-raw-Milk:6

Summary by CodeRabbit

  • Chores
    • DOCX file handling/rendering is now limited to the app build only. This reduces unnecessary docx-related logic in non-app distributions, streamlines builds, and can help reduce bundle size and potential edge-case behavior outside the app. No public APIs or exported signatures were changed.

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

A preprocessor-style conditional was added around the DOCX render-mode branch in a content selector, enclosing the existing docx-handling logic with app-only markers so that this code path is excluded from non-app builds. No functional logic was changed.

Changes

Cohort / File(s) Summary
Build Conditionals
ui/redux/selectors/content.js
Wrapped the DOCX (extension === 'docx') render-mode branches with app-only conditional markers: // @if TARGET='app' ... // @endif``, excluding that branch from non-app builds. No other logic changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 I tucked the DOCX path behind a gate,
Only app builds now may navigate,
Two tiny markers, tidy and neat,
Keep the branches well discrete. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix .docx file crash' clearly relates to the main change in the PR, which addresses a crash caused by DocxViewer import issues on non-app platforms.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-docx-crash

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ui/redux/selectors/content.js (1)

296-298: ⚠️ Potential issue | 🔴 Critical

Add missing // @if TARGET='app' guard around the docx check in selectFileRenderModeForUri.

The docx check in selectFileRenderModeForUri (lines 296–298) lacks the // @if TARGET='app' guard that exists in the equivalent makeSelectFileRenderModeForUri selector. While selectFileRenderModeForUri is not directly used in the codebase, it powers selectIsPlayableForUri which is called from content.js actions that execute on all builds, allowing unguarded DOCX rendering on web and triggering the crash this PR aims to fix.

Proposed fix
     if (['text', 'document', 'script'].includes(mediaType)) {
       return RENDER_MODES.DOCUMENT;
     }
+    // `@if` TARGET='app'
     if (extension === 'docx') {
       return RENDER_MODES.DOCX;
     }
+    // `@endif`

@keikari
Copy link
Contributor Author

keikari commented Feb 6, 2026

Coderabbit thing is now handled

@tzarebczan tzarebczan merged commit 42e28b4 into master Feb 6, 2026
3 checks passed
@tzarebczan tzarebczan deleted the fix-docx-crash branch February 6, 2026 12:07
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