mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-11-25 15:24:40 +03:00
## Description Closes #15468. A doc linked with `@` inside a table block (`/table`, not a database view) never appears in Bidirectional Links on either doc. The indexer's `affine:table` branch in `@affine/reader` only collects cell text, so the block document has no `refDocId`/`ref`, and the backlink query on `refDocId` finds nothing. The `affine:database` branch already collects inline references from rich-text cells. This change reads the inline references from each `prop:cells.*.text` value with the existing `getTextDeltasFromCellValue` and `collectInlineReferences` helpers, and sets `refDocId` and `ref` on the table block, the same way the database branch does. Scope: this fixes the TypeScript crawler, which the web app (IndexedDB storage) uses and which the desktop and mobile apps use as the fallback. The native crawler in `affine_doc_loader` (`read/block.rs`, `affine:table` branch) has the same gap, and this PR leaves it unchanged. Test: `should index references from table cells` in `packages/common/reader/__tests__/reader.spec.ts` fails without the fix (`expected undefined to deeply equal [ 'target-doc' ]`) and passes with it. ## Checklist - [x] I have signed the [AFFiNE Contributor License Agreement](https://cla-assistant.io/toeverything/AFFiNE) — required before merge; the `license/cla` check must be green ([how it works](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md#sign-the-cla-first)) - [x] The PR targets the `canary` branch and its title follows [Conventional Commits](https://www.conventionalcommits.org/) - [x] Tests are added or updated where it makes sense - [x] `yarn lint` and `yarn typecheck` pass locally - [x] If the PR code includes AI-generated edits, I have carefully reviewed it to ensure that the scope of the PR is consistent with what is claimed in the title and description, and that there are no redundant or invalid implementations. - [x] I agree that maintainers may close the PR without discussion if they consider the code quality to be too low. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit - **Bug Fixes** - Table cell text is now included when reading document blocks, and references within cells are captured for indexing. <!-- end of auto-generated comment: release notes by coderabbit.ai -->