Skip to content

fix(content-preview): Prevent stuck loading mask for custom previews - #4766

Merged
mergify[bot] merged 1 commit into
box:masterfrom
jmcbgaston:fix/custom-preview-loading-mask
Aug 11, 2026
Merged

fix(content-preview): Prevent stuck loading mask for custom previews#4766
mergify[bot] merged 1 commit into
box:masterfrom
jmcbgaston:fix/custom-preview-loading-mask

Conversation

@jmcbgaston

@jmcbgaston jmcbgaston commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Custom previews no longer start the preview loading state when the selected version changes. This prevents the loading mask from remaining over rendered content while preserving standard preview loading behavior.

Summary by CodeRabbit

  • Bug Fixes

    • Custom content previews no longer attempt to load the standard preview library.
    • Updating a custom preview now avoids unnecessary loading states and preview reloads.
    • Preview cleanup continues to work correctly when custom preview versions change.
  • Tests

    • Added regression coverage for custom preview updates and loading behavior.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b9517cb-c9e4-4a7c-87bb-8d96dffc7c4d

📥 Commits

Reviewing files that changed from the base of the PR and between 5d273fe and 28c8ef0.

📒 Files selected for processing (2)
  • src/elements/content-preview/ContentPreview.js
  • src/elements/content-preview/__tests__/ContentPreview.test.js

Walkthrough

ContentPreview.componentDidUpdate now skips Box Preview loading when renderCustomPreview is configured. A regression test verifies the custom preview update behavior.

Changes

Custom preview loading

Layer / File(s) Summary
Skip Box Preview reloads for custom previews
src/elements/content-preview/ContentPreview.js, src/elements/content-preview/__tests__/ContentPreview.test.js
componentDidUpdate bypasses Box Preview loading for custom previews. The test verifies preview destruction, isLoading: false, and no loadPreview() call.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: ready-to-merge

Suggested reviewers: shahzadaziz, nefaris, jchan106

Poem

I’m a rabbit with previews to spare,
Custom content now needs no Box Preview care.
Updates stay calm, loading stays light,
Tests guard the behavior just right. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the custom preview loading-mask fix and matches the primary change.
Description check ✅ Passed The description explains the custom preview behavior, the loading-mask issue, and the preserved standard preview behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Biome (2.5.6)
src/elements/content-preview/ContentPreview.js

File contains syntax errors that prevent linting: Line 21: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 36: 'import { type x ident }' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 67: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 68: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 69: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 70: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 71: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 72: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 73: '

... [truncated 19028 characters] ...

nly feature. Convert your file to a TypeScript file or remove the syntax.; Line 1601: type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 1613: type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 1620: Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 1652: expected ) but instead found :; Line 1652: Expected a JSX attribute but instead found ')'.; Line 1652: Unexpected token. Did you mean {'}'} or }?; Line 1652: Unexpected token. Did you mean {'>'} or >?; Line 1764: 'export type' declarations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.


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.

@jmcbgaston
jmcbgaston marked this pull request as ready for review August 10, 2026 23:31
@jmcbgaston
jmcbgaston requested review from a team as code owners August 10, 2026 23:31
@jmcbgaston

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-11 16:52 UTC · Rule: Automatic strict merge · triggered by @jmcbgaston with the @mergifyio queue command
  • Checks failed · in-place
  • 🚫 Left the queue2026-08-11 17:06 UTC · at c7d1e600496146f7df5ea11b077bfd0d54dd743e

This pull request spent 13 minutes 38 seconds in the queue, with no time running CI.

Waiting for any of
  • check-neutral = lint_test_build
  • check-skipped = lint_test_build
  • check-success = lint_test_build
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = lint_test_build
    • check-skipped = lint_test_build
    • check-success = lint_test_build
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Summary
    • check-neutral = Summary
    • check-skipped = Summary
  • any of [🛡 GitHub branch protection]:
    • check-success = license/cla
    • check-neutral = license/cla
    • check-skipped = license/cla
  • any of [🛡 GitHub branch protection]:
    • check-success = lint_pull_request
    • check-neutral = lint_pull_request
    • check-skipped = lint_pull_request

Reason

The merge conditions cannot be satisfied due to failing checks

Failing checks:

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Requeued — the merge queue status continues in this comment ↓.

Custom renderers own their loading lifecycle and do not initialize Box.Preview.
Avoid starting a loading session that has no matching preview load event.
@jmcbgaston
jmcbgaston force-pushed the fix/custom-preview-loading-mask branch from c7d1e60 to bcbfc9d Compare August 11, 2026 18:00
@mergify mergify Bot removed the dequeued label Aug 11, 2026
@jmcbgaston

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-11 18:10 UTC · Rule: Automatic strict merge · triggered by @jmcbgaston with the @mergifyio queue command
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-11 18:10 UTC · at bcbfc9d186f33afe95ce15de2ba0e9a87adb3568 · squash

This pull request spent 26 seconds in the queue, including 4 seconds running CI.

Required conditions to merge
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Summary
    • check-neutral = Summary
    • check-skipped = Summary
  • any of [🛡 GitHub branch protection]:
    • check-success = lint_test_build
    • check-neutral = lint_test_build
    • check-skipped = lint_test_build
  • any of [🛡 GitHub branch protection]:
    • check-success = license/cla
    • check-neutral = license/cla
    • check-skipped = license/cla
  • any of [🛡 GitHub branch protection]:
    • check-success = lint_pull_request
    • check-neutral = lint_pull_request
    • check-skipped = lint_pull_request

@mergify mergify Bot added the queued label Aug 11, 2026
@mergify
mergify Bot merged commit 1fdcc97 into box:master Aug 11, 2026
10 checks passed
@mergify mergify Bot removed the queued label Aug 11, 2026
@jmcbgaston
jmcbgaston deleted the fix/custom-preview-loading-mask branch August 11, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants