Skip to content

Commit 8d4347d

Browse files
authored
fix: make plan scrollable (#709)
1 parent a4047d1 commit 8d4347d

File tree

2 files changed

+147
-1
lines changed

2 files changed

+147
-1
lines changed

apps/twig/src/renderer/components/permissions/PermissionSelector.stories.tsx

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,135 @@ Add dark mode toggle to Twig app with theme persistence.
500500
- Restart app, verify theme persists
501501
- Test system theme option follows OS preference`,
502502
};
503+
504+
const largePlanInput = {
505+
plan: `# Complete Application Refactoring Plan
506+
507+
## Executive Summary
508+
This plan outlines a comprehensive refactoring of the application architecture to improve maintainability, performance, and developer experience. The changes will be implemented in phases to minimize disruption.
509+
510+
## Phase 1: State Management Overhaul
511+
512+
### 1.1 Migrate to New Store Architecture
513+
- Audit all existing Zustand stores for redundant state
514+
- Implement store slicing pattern for better code splitting
515+
- Add middleware for persistence, logging, and devtools
516+
- Create store factory functions for consistent patterns
517+
518+
### 1.2 Normalize Data Structures
519+
- Design normalized schema for entities (users, tasks, sessions)
520+
- Implement selectors with memoization using reselect
521+
- Add entity adapters for CRUD operations
522+
- Create relationship mappings between entities
523+
524+
### 1.3 Implement Optimistic Updates
525+
- Add rollback mechanisms for failed mutations
526+
- Create pending state tracking for UI feedback
527+
- Implement conflict resolution strategies
528+
- Add retry logic with exponential backoff
529+
530+
## Phase 2: API Layer Improvements
531+
532+
### 2.1 Implement Request Caching
533+
- Add SWR-style caching with stale-while-revalidate
534+
- Implement cache invalidation strategies
535+
- Add prefetching for anticipated requests
536+
- Create cache persistence layer
537+
538+
### 2.2 Error Handling Standardization
539+
- Create unified error types and codes
540+
- Implement error boundary components
541+
- Add structured logging for errors
542+
- Create error recovery workflows
543+
544+
### 2.3 Request Batching
545+
- Implement DataLoader pattern for batching
546+
- Add request deduplication
547+
- Create priority queue for requests
548+
- Implement cancellation tokens
549+
550+
## Phase 3: Component Architecture
551+
552+
### 3.1 Component Library Extraction
553+
- Identify reusable components
554+
- Create component documentation with Storybook
555+
- Implement visual regression testing
556+
- Add accessibility testing
557+
558+
### 3.2 Performance Optimization
559+
- Implement code splitting at route level
560+
- Add lazy loading for heavy components
561+
- Optimize bundle size with tree shaking
562+
- Implement virtual scrolling for lists
563+
564+
### 3.3 Testing Infrastructure
565+
- Set up unit testing with Vitest
566+
- Add integration tests with Testing Library
567+
- Implement E2E tests with Playwright
568+
- Create test data factories
569+
570+
## Phase 4: Developer Experience
571+
572+
### 4.1 Tooling Improvements
573+
- Configure ESLint with strict rules
574+
- Add Prettier for formatting
575+
- Implement husky for git hooks
576+
- Add commitlint for commit messages
577+
578+
### 4.2 Documentation
579+
- Create architecture decision records
580+
- Write API documentation
581+
- Add inline code documentation
582+
- Create onboarding guides
583+
584+
### 4.3 CI/CD Pipeline
585+
- Set up automated testing
586+
- Implement deployment previews
587+
- Add performance budgets
588+
- Create release automation
589+
590+
## Critical Files to Modify
591+
592+
### Store Files
593+
- \`src/stores/index.ts\` - Store exports
594+
- \`src/stores/user-store.ts\` - User state
595+
- \`src/stores/task-store.ts\` - Task state
596+
- \`src/stores/session-store.ts\` - Session state
597+
- \`src/stores/middleware/\` - Custom middleware
598+
599+
### API Files
600+
- \`src/api/client.ts\` - API client
601+
- \`src/api/cache.ts\` - Caching layer
602+
- \`src/api/errors.ts\` - Error handling
603+
- \`src/api/hooks/\` - React Query hooks
604+
605+
### Component Files
606+
- \`src/components/ui/\` - Base components
607+
- \`src/components/forms/\` - Form components
608+
- \`src/components/layout/\` - Layout components
609+
- \`src/features/\` - Feature modules
610+
611+
## Risk Assessment
612+
613+
| Risk | Impact | Mitigation |
614+
|------|--------|------------|
615+
| Breaking changes | High | Feature flags, gradual rollout |
616+
| Performance regression | Medium | Benchmarking, monitoring |
617+
| Developer friction | Low | Documentation, training |
618+
| Data migration | High | Backup, rollback plan |
619+
620+
## Timeline Estimate
621+
- Phase 1: 2-3 weeks
622+
- Phase 2: 2 weeks
623+
- Phase 3: 3-4 weeks
624+
- Phase 4: 1-2 weeks
625+
626+
## Success Metrics
627+
- 50% reduction in bundle size
628+
- 30% improvement in Time to Interactive
629+
- 90% test coverage
630+
- Zero critical bugs in production`,
631+
};
503632
export const ExitPlanMode: Story = {
504633
args: {
505634
toolCall: {
@@ -517,6 +646,23 @@ export const ExitPlanMode: Story = {
517646
},
518647
};
519648

649+
export const ExitPlanModeLarge: Story = {
650+
args: {
651+
toolCall: {
652+
toolCallId: `story-${Date.now()}`,
653+
title: "Approve this plan to proceed?",
654+
kind: "switch_mode",
655+
content: [
656+
{
657+
type: "content",
658+
content: { type: "text", text: largePlanInput.plan },
659+
},
660+
],
661+
},
662+
options: buildExitPlanModePermissionOptions(),
663+
},
664+
};
665+
520666
const singleQuestion: QuestionItem[] = [
521667
{
522668
question: "Which testing framework do you prefer?",

apps/twig/src/renderer/components/permissions/PlanContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface PlanContentProps {
88

99
export function PlanContent({ plan }: PlanContentProps) {
1010
return (
11-
<Box className="rounded-lg border-2 border-blue-6 bg-blue-2 p-4">
11+
<Box className="max-h-[50vh] overflow-y-auto rounded-lg border-2 border-blue-6 bg-blue-2 p-4">
1212
<Box className="plan-markdown text-blue-12">
1313
<ReactMarkdown remarkPlugins={[remarkGfm]}>{plan}</ReactMarkdown>
1414
</Box>

0 commit comments

Comments
 (0)