Skip to content

fix: give row documents a real parent so nested pages keep breadcrumbs#8868

Open
hkarmoush wants to merge 2 commits into
AppFlowy-IO:mainfrom
hkarmoush:fix/row-document-breadcrumb-8432
Open

fix: give row documents a real parent so nested pages keep breadcrumbs#8868
hkarmoush wants to merge 2 commits into
AppFlowy-IO:mainfrom
hkarmoush:fix/row-document-breadcrumb-8432

Conversation

@hkarmoush

@hkarmoush hkarmoush commented Jul 17, 2026

Copy link
Copy Markdown

What & why

Reported in #8432: creating a page inside a database row's own note/document loses its breadcrumb, and its location shows up as "Untitled" wherever it's referenced — basically orphaned.

Root cause: a row's inline document is created as a special "orphan view" whose parent_view_id is set to its own id, purely so it stays out of the sidebar. That's intentional for the row document itself — but any page you create inside it inherits that self-referencing parent. When the app walks up the ancestor chain to build breadcrumbs, it hits the row document, loops back on itself, and stops. It never reaches the actual database/grid view, the space, or the workspace, so the breadcrumb bar has nothing real to show.

This PR lets the orphan view report the database's own view as its parent for ancestor-chain purposes, without adding it to that view's visible children (sidebar visibility is controlled separately — by whether a view was inserted into a parent's child list — so this doesn't change what shows up under the database). Pages created inside a row's document now resolve their full breadcrumb path again.

Changes

  • flowy-folder: CreateOrphanViewPayloadPB gains an optional parent_view_id; defaults to the old self-referencing behavior when omitted, so nothing else that creates orphan views is affected.
  • Desktop (RowDocumentBloc) and mobile (OpenRowPageButton) now pass the database's view id when creating a row's document.
  • Added create_orphan_view_with_explicit_parent_and_get_its_ancestors_test, covering: the orphan reports the real parent, a page nested inside it inherits the full ancestor chain, and the orphan still doesn't show up as a visible child of the database view.

Note

I put this together without a Rust/protoc toolchain on hand, so I haven't been able to run cargo make code_generation or the test suite myself. Opening as a draft so CI (or a reviewer) can catch anything I couldn't — will fix up based on results.

fixes #8432


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing. (unverified locally — no toolchain available, relying on CI)

Summary by Sourcery

Ensure orphan views can report a real parent for ancestor resolution so nested row documents retain correct breadcrumbs without becoming visible sidebar children.

New Features:

  • Allow specifying an explicit parent view when creating orphan views so their ancestor chains can link back to the owning database or workspace.

Enhancements:

  • Extend CreateOrphanViewPayloadPB and ViewBackendService to support an optional parent_view_id that defaults to the orphan view’s own id when not provided.
  • Wire desktop and mobile row document creation to pass the database view id as the parent for row document orphan views.

Tests:

  • Add an integration test verifying that orphan views with explicit parents report the correct ancestor chain, that nested child views inherit the full ancestry, and that the orphan remains hidden from the parent’s visible children.

@CLAassistant

CLAassistant commented Jul 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sourcery-ai

sourcery-ai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds an optional explicit parent_view_id to orphan view creation and wires desktop/mobile row document flows to pass the database view id so orphan row documents report a real parent for ancestor/breadcrumb resolution while remaining hidden from sidebar children, with tests covering ancestor chains and visibility behavior.

Sequence diagram for orphan row document creation with explicit parent view

sequenceDiagram
  actor User
  participant RowDocumentBloc
  participant ViewBackendService
  participant FolderEventCreateOrphanView
  participant BackendCreateOrphanViewPayloadPB

  User->>RowDocumentBloc: _createRowDocumentView(documentViewId)
  RowDocumentBloc->>ViewBackendService: createOrphanView(viewId: documentViewId, parentViewId: viewId)
  ViewBackendService->>FolderEventCreateOrphanView: FolderEventCreateOrphanView(payload)
  FolderEventCreateOrphanView->>BackendCreateOrphanViewPayloadPB: send()
  BackendCreateOrphanViewPayloadPB->>BackendCreateOrphanViewPayloadPB: try_into(CreateViewParams)
  BackendCreateOrphanViewPayloadPB-->>FolderEventCreateOrphanView: CreateViewParams{parent_view_id: parentViewId}
  FolderEventCreateOrphanView-->>ViewBackendService: ViewPB
  ViewBackendService-->>RowDocumentBloc: ViewPB
  RowDocumentBloc-->>User: row document view with correct ancestors
Loading

File-Level Changes

Change Details Files
Allow orphan views to specify an explicit parent for ancestor-chain and breadcrumb resolution while defaulting to previous self-parenting behavior.
  • Extend CreateOrphanViewPayloadPB with an optional parent_view_id field, defaulting to the view’s own id when omitted.
  • Update TryInto for CreateOrphanViewPayloadPB to derive parent_view_id from the payload and validate it as a UUID.
  • Add Rust helper create_orphan_view_with_parent to construct orphan views with an explicit parent while keeping the existing create_orphan_view API as a wrapper.
frontend/rust-lib/flowy-folder/src/entities/view.rs
frontend/rust-lib/event-integration-test/src/folder_event.rs
Wire desktop and mobile row document creation to pass the database view id as the orphan document’s parent.
  • Store the database view id on RowDocumentBloc and pass it as parentViewId when creating the row’s document view.
  • Extend ViewBackendService.createOrphanView to accept an optional parentViewId and populate it into the payload when provided.
  • Update the mobile OpenRowPageButton to pass the database controller’s viewId as parentViewId when creating the row’s document view.
frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_document_bloc.dart
frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/widgets/row_page_button.dart
Add integration coverage ensuring orphan views with explicit parents expose correct ancestor chains to nested children and remain hidden from visible children lists.
  • Add create_orphan_view_with_explicit_parent_and_get_its_ancestors_test verifying the orphan’s ancestors include the real parent and end with the orphan itself.
  • Within the test, create a child view inside the orphan and assert its ancestor chain includes both the orphan and the real parent.
  • Assert that the orphan view does not appear in the real parent’s child_views list, confirming sidebar visibility is unchanged.
frontend/rust-lib/event-integration-test/tests/folder/local_test/folder_test.rs

Assessment against linked issues

Issue Objective Addressed Explanation
#8432 Ensure documents created inside a database row’s detail page inherit the correct ancestor chain (Workspace > Database > Row > Document) so breadcrumbs and location are shown properly.
#8432 Fix nested documents inside row detail pages appearing as orphaned (e.g., showing location as "Untitled" when searched) by giving the row document a real parent view.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@hkarmoush
hkarmoush marked this pull request as ready for review July 17, 2026 23:58

@sourcery-ai sourcery-ai 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.

Hey - I've left some high level feedback:

  • In folder_event.rs, the doc comment for create_orphan_view (“parent_view_id equal to the view_id”) is now only conditionally true; consider updating it to clarify the default vs explicit parent behavior and reference create_orphan_view_with_parent so future callers understand when to use each.
  • The _createRowDocumentView method in RowDocumentBloc now takes a documentViewId while using the bloc’s viewId as the parent; it may be clearer to rename parameters/fields or add a brief comment to distinguish “database view id” vs “row document view id” and avoid confusion about which id is passed where.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `folder_event.rs`, the doc comment for `create_orphan_view` (“parent_view_id equal to the view_id”) is now only conditionally true; consider updating it to clarify the default vs explicit parent behavior and reference `create_orphan_view_with_parent` so future callers understand when to use each.
- The `_createRowDocumentView` method in `RowDocumentBloc` now takes a `documentViewId` while using the bloc’s `viewId` as the parent; it may be clearer to rename parameters/fields or add a brief comment to distinguish “database view id” vs “row document view id” and avoid confusion about which id is passed where.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

hkarmoush and others added 2 commits July 18, 2026 12:17
A row's own inline document is created as an "orphan view" whose
parent_view_id points at itself, so it's invisible in the sidebar.
That's fine for the row document itself, but any page created inside
it inherited that dead-end parent, so the ancestor lookup used for
breadcrumbs stopped right there instead of continuing up to the
database and workspace.

Let the orphan view report the database's view as its parent for
ancestor-chain purposes while still keeping it out of the database's
visible children, so nested pages resolve their full breadcrumb path
again.

Fixes AppFlowy-IO#8432

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The create_orphan_view doc comment still claimed parent_view_id always
equals view_id, which stopped being true once an explicit parent was
supported — pointed it at create_orphan_view_with_parent instead.

Also renamed a parameter in RowDocumentBloc so it's clear which id is
the database view (used as the orphan's parent) and which is the row's
own document view (used as the orphan's view_id) — they were both just
called "viewId" in different places, which is what a reviewer flagged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hkarmoush
hkarmoush force-pushed the fix/row-document-breadcrumb-8432 branch from b45f112 to 8ea3b69 Compare July 18, 2026 09:18
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.

[Bug] Nested document inside database row page shows "Untitled" (when searched) and lacks location breadcrumbs

2 participants