Skip to content

feat(canvas): per-channel CONTEXT.md replacing Settings entry#2589

Merged
raquelmsmith merged 4 commits into
mainfrom
feat/channel-context-md
Jun 11, 2026
Merged

feat(canvas): per-channel CONTEXT.md replacing Settings entry#2589
raquelmsmith merged 4 commits into
mainfrom
feat/channel-context-md

Conversation

@raquelmsmith

@raquelmsmith raquelmsmith commented Jun 11, 2026

Copy link
Copy Markdown
Member

video desc

https://www.loom.com/share/84096ec91e3143dca32d70390bffc2ec

Summary

  • Replaces the placeholder Settings entry under each channel in the canvas sidebar with a CONTEXT.md entry that opens a versioned, deep-linkable markdown editor.
  • Wires the desktop folder-instructions endpoints from feat(file-system): add versioned instructions for desktop folders posthog#61494 into a new useFolderInstructions hook + WebsiteContext view: rendered/edit toggle, save publishes a new version with optimistic concurrency, version dropdown surfaces history.
  • Refetches latest on every mount so the view reflects edits made by other users or agents.

Notes

Test plan

  • Open a channel, click CONTEXT.md — empty state renders with channel name.
  • Create + save: new version appears; rendered mode shows markdown.
  • Edit + save again: version dropdown lists both versions; "Latest" selection works.
  • Open same channel from a second client; remote edit appears on mount (no refresh).
  • Old per-channel /settings URL no longer resolves; route gone from generated tree.

🤖 Generated with Claude Code

Wires the desktop folder-instructions endpoints (PostHog/posthog#61494)
into a per-channel CONTEXT.md entry in the channels sidebar, replacing
the placeholder Settings option. Clicking opens a deep-linkable route
with rendered/edit toggle; save publishes a new version with optimistic
concurrency; a version dropdown surfaces history. Refetches on every
mount so the view reflects edits made by other users or agents.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. packages/ui/src/features/canvas/components/WebsiteContext.tsx, line 450-458 (link)

    P2 Conflict callout has no action

    The message says "Reload to merge your changes" but there is no button to perform that reload. The user is left in edit mode with their draft and a stale baseVersion, unable to proceed except by clicking "Discard" and manually re-entering their changes. Consider adding a "Reload" button that calls queryClient.invalidateQueries on the instructions key and re-seeds the draft — or at minimum change the message to "Discard your changes and reload to see the latest version" to match the only available action.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/ui/src/features/canvas/components/WebsiteContext.tsx
    Line: 450-458
    
    Comment:
    **Conflict callout has no action**
    
    The message says "Reload to merge your changes" but there is no button to perform that reload. The user is left in edit mode with their draft and a stale `baseVersion`, unable to proceed except by clicking "Discard" and manually re-entering their changes. Consider adding a "Reload" button that calls `queryClient.invalidateQueries` on the instructions key and re-seeds the draft — or at minimum change the message to "Discard your changes and reload to see the latest version" to match the only available action.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
packages/ui/src/features/canvas/components/WebsiteContext.tsx:234
Saving empty content is possible when the user manually switches to edit mode via the SegmentedControl (bypassing the EmptyState "Create CONTEXT.md" button). In that case `hasDraft` is `false` and `hasInstructions` is `false`, so disabled evaluates to `false`, and clicking "Save new version" publishes an empty string. After the save, `hasInstructions` is still `false` (empty string trims to nothing), so the component re-renders the EmptyState — creating a ghost version with no content.

```suggestion
              disabled={isPublishing || (hasInstructions ? !hasDraft : draft.trim().length === 0)}
```

### Issue 2 of 2
packages/ui/src/features/canvas/components/WebsiteContext.tsx:450-458
**Conflict callout has no action**

The message says "Reload to merge your changes" but there is no button to perform that reload. The user is left in edit mode with their draft and a stale `baseVersion`, unable to proceed except by clicking "Discard" and manually re-entering their changes. Consider adding a "Reload" button that calls `queryClient.invalidateQueries` on the instructions key and re-seeds the draft — or at minimum change the message to "Discard your changes and reload to see the latest version" to match the only available action.

Reviews (1): Last reviewed commit: "feat(canvas): per-channel CONTEXT.md rep..." | Re-trigger Greptile

size="1"
variant="solid"
onClick={onSave}
disabled={isPublishing || (!hasDraft && hasInstructions)}

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.

P2 Saving empty content is possible when the user manually switches to edit mode via the SegmentedControl (bypassing the EmptyState "Create CONTEXT.md" button). In that case hasDraft is false and hasInstructions is false, so disabled evaluates to false, and clicking "Save new version" publishes an empty string. After the save, hasInstructions is still false (empty string trims to nothing), so the component re-renders the EmptyState — creating a ghost version with no content.

Suggested change
disabled={isPublishing || (!hasDraft && hasInstructions)}
disabled={isPublishing || (hasInstructions ? !hasDraft : draft.trim().length === 0)}
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/features/canvas/components/WebsiteContext.tsx
Line: 234

Comment:
Saving empty content is possible when the user manually switches to edit mode via the SegmentedControl (bypassing the EmptyState "Create CONTEXT.md" button). In that case `hasDraft` is `false` and `hasInstructions` is `false`, so disabled evaluates to `false`, and clicking "Save new version" publishes an empty string. After the save, `hasInstructions` is still `false` (empty string trims to nothing), so the component re-renders the EmptyState — creating a ghost version with no content.

```suggestion
              disabled={isPublishing || (hasInstructions ? !hasDraft : draft.trim().length === 0)}
```

How can I resolve this? If you propose a fix, please make it concise.

@raquelmsmith raquelmsmith requested a review from adamleithp June 11, 2026 03:33
@raquelmsmith raquelmsmith marked this pull request as ready for review June 11, 2026 03:33
…xist

Greptile noticed: user can switch to edit mode via SegmentedControl with no
prior version and no draft, hitting Save publishes an empty string and
re-renders the EmptyState — a ghost v1 with no body. Require non-whitespace
draft when there are no instructions yet; preserve no-op-on-clean-edit when
a version already exists.
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

React Doctor could not complete this scan.

No React dependency found in /tmp/react-doctor-baseline-971Bm8/package.json. Add "react" to dependencies (or peerDependencies) and re-run.

Reviewed by React Doctor for commit 480484c.

@raquelmsmith raquelmsmith merged commit ed8ad0e into main Jun 11, 2026
23 checks passed
@raquelmsmith raquelmsmith deleted the feat/channel-context-md branch June 11, 2026 16:36
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.

1 participant