# Task: Backlink Auto-Connection Fix

## Context
User reported an issue where `[[WikiLinks]]` created for non-existent documents (which display as "New Document" links) did not automatically update to standard links when the target document was subsequently created.

## Analysis
- **Root Cause**: The `WikiLinkExtension` in Tiptap stores the `id` of the link. For new documents, this ID is generated as `new-Title`. When the real document is created, it gets a Firestore ID, but the existing link in other documents retains the `new-Title` ID because there was no logic to update it.
- **Impact**: Users had to mutually re-edit links to make them valid, breaking the "seamless" wiki experience.

## Solution
Implemented a reconciliation logic in `ReflectEditor.tsx`:
1.  **Watch `wikiMap`**: The editor already subscribes to `wikiMap` updates.
2.  **Scan & Heal**: When `wikiMap` updates:
    -   Scans the current editor document for `wikiLink` nodes.
    -   Identifies nodes with `id` starting with `new-`.
    -   Extracts the title (e.g., from `new-Title` or the node's label).
    -   Checks if this title now exists in `wikiMap`.
    -   If found, creates a transaction to update the node's `id` attribute to the real Firestore ID.
3.  **Result**: Links automatically turn "blue" (valid) and point to the correct document without user intervention.

## Verification
- **Build**: `npm run build` passed successfully.
- **Logic**: The `useEffect` hook correctly identifies and updates the attributes within the ProseMirror transaction system.

## Status
- **Implemented**: `ReflectEditor.tsx` updated.
- **Deployed**: Pushed to master.
