Skip to content

Conversation

@kylecarbs
Copy link
Member

We should not use props to pass context. It's very complex for testing and inefficient long-term.

In a future PR I will split out workspaces.

@kylecarbs kylecarbs self-assigned this Nov 14, 2025
We should not use props to pass context. It's very complex for testing and inefficient long-term.

In a future PR I will split out workspaces.
kylecarbs added a commit that referenced this pull request Nov 14, 2025
Following the pattern from PR #600 (projects split), this moves workspace
state management from useWorkspaceManagement hook into a dedicated
WorkspaceContext.

- Created WorkspaceContext with workspace metadata, operations (create/remove/rename),
  and selection state
- Comprehensive test coverage (14 tests) matching ProjectContext test patterns
- Updated AppLoader to use WorkspaceProvider wrapper
- Maintains same API surface for existing components via AppContext pass-through
- Tests verify metadata loading, CRUD operations, event subscriptions, and error handling

This eliminates prop drilling and centralizes workspace state management,
making it easier to test and maintain workspace operations independently.
kylecarbs added a commit that referenced this pull request Nov 14, 2025
- Add eslint disable comments for test file mocks (consistent with PR #600 pattern)
- Fix react-hooks/exhaustive-deps warnings by destructuring props in effects
- Change empty arrow function to use comment (no-op setWorkspaceMetadata)
- Remove await from non-promise expect call in tests
@kylecarbs kylecarbs merged commit af4c2af into main Nov 15, 2025
13 checks passed
@kylecarbs kylecarbs deleted the project-context branch November 15, 2025 15:16
kylecarbs added a commit that referenced this pull request Nov 15, 2025
Following the pattern from PR #600 (projects split), this moves workspace
state management from useWorkspaceManagement hook into a dedicated
WorkspaceContext.

- Created WorkspaceContext with workspace metadata, operations (create/remove/rename),
  and selection state
- Comprehensive test coverage (14 tests) matching ProjectContext test patterns
- Updated AppLoader to use WorkspaceProvider wrapper
- Maintains same API surface for existing components via AppContext pass-through
- Tests verify metadata loading, CRUD operations, event subscriptions, and error handling

This eliminates prop drilling and centralizes workspace state management,
making it easier to test and maintain workspace operations independently.
kylecarbs added a commit that referenced this pull request Nov 15, 2025
- Add eslint disable comments for test file mocks (consistent with PR #600 pattern)
- Fix react-hooks/exhaustive-deps warnings by destructuring props in effects
- Change empty arrow function to use comment (no-op setWorkspaceMetadata)
- Remove await from non-promise expect call in tests
kylecarbs added a commit that referenced this pull request Nov 15, 2025
Following the pattern from PR #600 (projects split), this moves workspace
state management from useWorkspaceManagement hook into a dedicated
WorkspaceContext.

- Created WorkspaceContext with workspace metadata, operations (create/remove/rename),
  and selection state
- Comprehensive test coverage (14 tests) matching ProjectContext test patterns
- Updated AppLoader to use WorkspaceProvider wrapper
- Maintains same API surface for existing components via AppContext pass-through
- Tests verify metadata loading, CRUD operations, event subscriptions, and error handling

This eliminates prop drilling and centralizes workspace state management,
making it easier to test and maintain workspace operations independently.
kylecarbs added a commit that referenced this pull request Nov 15, 2025
- Add eslint disable comments for test file mocks (consistent with PR #600 pattern)
- Fix react-hooks/exhaustive-deps warnings by destructuring props in effects
- Change empty arrow function to use comment (no-op setWorkspaceMetadata)
- Remove await from non-promise expect call in tests
kylecarbs added a commit that referenced this pull request Nov 15, 2025
Following the pattern from PR #600 (projects split), this moves workspace
state management from useWorkspaceManagement hook into a dedicated
WorkspaceContext.

- Created WorkspaceContext with workspace metadata, operations (create/remove/rename),
  and selection state
- Comprehensive test coverage (14 tests) matching ProjectContext test patterns
- Updated AppLoader to use WorkspaceProvider wrapper
- Maintains same API surface for existing components via AppContext pass-through
- Tests verify metadata loading, CRUD operations, event subscriptions, and error handling

This eliminates prop drilling and centralizes workspace state management,
making it easier to test and maintain workspace operations independently.
kylecarbs added a commit that referenced this pull request Nov 15, 2025
- Add eslint disable comments for test file mocks (consistent with PR #600 pattern)
- Fix react-hooks/exhaustive-deps warnings by destructuring props in effects
- Change empty arrow function to use comment (no-op setWorkspaceMetadata)
- Remove await from non-promise expect call in tests
kylecarbs added a commit that referenced this pull request Nov 15, 2025
Following the pattern from PR #600, this moves workspace state
management from `useWorkspaceManagement` hook into a dedicated
`WorkspaceContext`.

## Changes

**Created WorkspaceContext:**
- Manages workspace metadata, CRUD operations (create/remove/rename)
- Handles selection state and workspace creation flow
- Subscribes to metadata update events
- Provides workspace info retrieval

**Comprehensive test coverage:**
- 14 tests covering all context operations
- Tests metadata loading, CRUD operations, event subscriptions, error
handling
- Matches ProjectContext test patterns from PR #600

**Updated AppLoader:**
- Uses WorkspaceProvider to wrap app initialization
- Maintains same API surface for existing components via AppContext
pass-through
- No changes required to App.tsx or other components

## Testing

```bash
bun test src/contexts/WorkspaceContext.test.tsx
make typecheck
```

All tests pass, typechecks clean.

---
_Generated with `mux`_
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