Skip to content

fix: hide note outline for blurred memos - #6160

Open
Shivajith754 wants to merge 3 commits into
usememos:mainfrom
Shivajith754:fix/blurred-memo-leaks-headings-in-note-outline-eff68f
Open

fix: hide note outline for blurred memos#6160
Shivajith754 wants to merge 3 commits into
usememos:mainfrom
Shivajith754:fix/blurred-memo-leaks-headings-in-note-outline-eff68f

Conversation

@Shivajith754

Copy link
Copy Markdown

Fixes #6158

Hide the note outline while blurred content is hidden, and restore it after reveal.

Added regression coverage.

@Shivajith754
Shivajith754 requested a review from a team as a code owner August 7, 2026 03:56
@coderabbitai

coderabbitai Bot commented Aug 7, 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: 5111bd25-ba60-4f29-af0d-343cfb9431df

📥 Commits

Reviewing files that changed from the base of the PR and between 914702c and 60eb3e9.

📒 Files selected for processing (1)
  • web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx

Walkthrough

Memo detail tracks blurred-content visibility by memo navigation state. MemoView supports controlled or local visibility state. MemoDetailSidebar hides headings for blurred memos until settings initialize or content is shown. Sidebar registration forwards the visibility state. Tests cover outline filtering and state reset during navigation.

Suggested reviewers: boojack, johnnyjoygh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: hiding the note outline for blurred memos.
Description check ✅ Passed The description accurately explains the fix for blurred memo outlines and mentions regression coverage.
Linked Issues check ✅ Passed The changes hide headings until blurred content is revealed and add coverage for loading and navigation cases [#6158].
Out of Scope Changes check ✅ Passed The changes are limited to blur visibility, sidebar outline behavior, state management, and related regression tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown

Greptile Summary

The PR prevents memo outlines from exposing headings while blurred content is hidden and synchronizes outline visibility with the memo reveal state.

  • Propagates controlled blur visibility from MemoDetail through the app-sidebar descriptor.
  • Hides headings while tag settings are unresolved or a blurred memo remains concealed.
  • Resets reveal state during memo navigation and adds regression coverage for navigation and sidebar behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
web/src/pages/MemoDetail.tsx Controls reveal state by memo identity, resets it on direct or shared-memo navigation, and propagates it consistently to the memo view and sidebar.
web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx Derives blur status from user tag settings and suppresses outline extraction until settings load or concealed content is revealed.
web/src/components/MemoView/MemoView.tsx Supports externally controlled blur visibility while retaining local behavior for existing uncontrolled callers.
web/src/contexts/AppSidebarContext.tsx Extends the memo-detail sidebar descriptor with the synchronized reveal state.
web/src/components/AppSidebar/AppSidebar.tsx Passes the registered reveal state into the memo-detail sidebar.
web/tests/memo-detail-blur-navigation.test.tsx Covers resetting concealed state when navigating away from and back to a previously revealed memo.
web/tests/memo-detail-sidebar.test.tsx Covers hidden, revealed, and settings-loading outline states using the declared component contract.

Reviews (5): Last reviewed commit: "Repair Blurred memo leaks headings in no..." | Re-trigger Greptile

Comment thread web/src/pages/MemoDetail.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/pages/MemoDetail.tsx`:
- Around line 36-38: Change the descriptor-registration hook in MemoDetail from
useEffect to useLayoutEffect so setMemoDetail runs before the sidebar paints,
while preserving its dependency list and leaving the unmount cleanup effect as a
regular useEffect.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a1a65c2-633b-4f3d-a47c-820b8d77ab37

📥 Commits

Reviewing files that changed from the base of the PR and between e5ed6e7 and f59ed46.

📒 Files selected for processing (7)
  • web/src/components/AppSidebar/AppSidebar.tsx
  • web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx
  • web/src/components/MemoView/MemoView.tsx
  • web/src/components/MemoView/types.ts
  • web/src/contexts/AppSidebarContext.tsx
  • web/src/pages/MemoDetail.tsx
  • web/tests/memo-detail-sidebar.test.tsx

Comment thread web/src/pages/MemoDetail.tsx Outdated
Comment on lines +36 to +38
useEffect(() => {
setMemoDetail({ memo, from, readonly, onShareImageOpen });
}, [from, memo, onShareImageOpen, readonly, setMemoDetail]);
setMemoDetail({ memo, from, readonly, onShareImageOpen, blurred, showBlurredContent });
}, [blurred, from, memo, onShareImageOpen, readonly, setMemoDetail, showBlurredContent]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Locate candidate file:"
fd -a 'MemoDetail\.tsx$' . || true

echo
echo "Show relevant file outline/size:"
if [ -f web/src/pages/MemoDetail.tsx ]; then
  wc -l web/src/pages/MemoDetail.tsx
  ast-grep outline web/src/pages/MemoDetail.tsx || true
  echo
  echo "Relevant source:"
  sed -n '1,220p' web/src/pages/MemoDetail.tsx | cat -n
fi

echo
echo "Search MemoDetailSidebar/context usages:"
rg -n "MemoDetail|MemoSidebarRegistration|MemoDetailSidebar|memoDetail|useMemode|MemoDetailContext|useMemoDetail" web/src || true

Repository: usememos/memos

Length of output: 16257


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "AppSidebarContext:"
sed -n '1,80p' web/src/contexts/AppSidebarContext.tsx | cat -n

echo
echo "MemoDetailSidebar outline and blur/render sections:"
wc -l web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx
ast-grep outline web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx || true
rg -n "blurred|showBlurredContent|Heading|showBlurredContent|memo\.name|children|Outline|toc|TableOf" web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx -C 3

echo
echo "Sidebar render block:"
sed -n '340,425p' web/src/components/AppSidebar/AppSidebar.tsx | cat -n

echo
echo "MemoDetailSidebar relevant sections:"
sed -n '1,220p' web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx | cat -n

Repository: usememos/memos

Length of output: 18293


Synchronize blur state before the sidebar can paint.

MemoSidebarRegistration writes memoDetail after the render, so the sidebar can still render the stale descriptor before useEffect runs. Switch this descriptor update to useLayoutEffect; keep the unmount cleanup effect as a regular useEffect.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/pages/MemoDetail.tsx` around lines 36 - 38, Change the
descriptor-registration hook in MemoDetail from useEffect to useLayoutEffect so
setMemoDetail runs before the sidebar paints, while preserving its dependency
list and leaving the unmount cleanup effect as a regular useEffect.

@alloyqa-for-github
alloyqa-for-github Bot force-pushed the fix/blurred-memo-leaks-headings-in-note-outline-eff68f branch from f59ed46 to 36a39b7 Compare August 7, 2026 04:41
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

Comment thread web/tests/memo-detail-sidebar.test.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx`:
- Line 31: Align the MemoDetailSidebar prop contract with the regression test by
choosing one supported blur API: update the test to provide the required blur
metadata and pass showBlurredContent, or add and consistently handle an explicit
blurred prop in the Props definition and component logic. Ensure the test
compiles and the memo is treated as blurred at runtime.
- Around line 81-85: Update MemoDetailSidebar’s blurred calculation to wait for
resolved user tag settings, using isUserSettingsInitialized to prevent headings
from being extracted while settings are still loading. Preserve the existing
showBlurredContent behavior once settings are initialized, and use the existing
resolved blur state if MemoDetail already provides one.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 50bbf517-a5e2-4e13-a26c-e4db7b1fe72a

📥 Commits

Reviewing files that changed from the base of the PR and between e5ed6e7 and 36a39b7.

📒 Files selected for processing (7)
  • web/src/components/AppSidebar/AppSidebar.tsx
  • web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx
  • web/src/components/MemoView/MemoView.tsx
  • web/src/components/MemoView/types.ts
  • web/src/contexts/AppSidebarContext.tsx
  • web/src/pages/MemoDetail.tsx
  • web/tests/memo-detail-sidebar.test.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • web/tests/memo-detail-sidebar.test.tsx
  • web/src/contexts/AppSidebarContext.tsx
  • web/src/components/MemoView/types.ts
  • web/src/components/MemoView/MemoView.tsx
  • web/src/pages/MemoDetail.tsx

Comment thread web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx
Comment thread web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx Outdated
@alloyqa-for-github
alloyqa-for-github Bot force-pushed the fix/blurred-memo-leaks-headings-in-note-outline-eff68f branch from 36a39b7 to f59ed46 Compare August 7, 2026 04:49
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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.

Blurred notes leak note outline in seperate note view

1 participant