Skip to content

Conversation

eamodio
Copy link
Member

@eamodio eamodio commented Oct 3, 2025

Introduces significant improvements to the state management and initialization of the Commit Details webview app. It adds a new context-based state provider for better state handling, updates component imports for consistency, and enhances the initialization of the root component with explicit properties. These changes set the foundation for more robust and maintainable state management across the app.

State Management Enhancements:

  • Added a new CommitDetailsStateProvider class in stateProvider.ts to manage and propagate state updates using a context provider, supporting real-time updates from IPC messages and user actions.
  • Introduced a stateContext using @lit/context in context.ts to enable context-based state sharing across components.

Component and Initialization Updates:

  • Updated the root component initialization in commitDetails.html to pass explicit name, placement, and bootstrap (state) properties to <gl-commit-details-app>, improving clarity and future extensibility.
  • Set a global webpackResourceBasePath variable in commitDetails.html for consistent resource loading.
  • Fixed the import path for uncommittedSha in gl-commit-details.ts to reference the correct module, improving maintainability.ails webview by converting it to a component-based architecture

@eamodio eamodio requested review from Copilot and d13 and removed request for Copilot October 3, 2025 18:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Introduces a context-based state management architecture for the Commit Details webview, replacing the previous monolithic component with a host + state provider pattern for improved maintainability and clearer initialization.

  • Adds CommitDetailsStateProvider with IPC-driven state updates exposed via lit context
  • Replaces legacy commit-details-app component logic with a GlAppHost-based implementation in commitDetails.ts
  • Updates HTML bootstrap and adds a global webpackResourceBasePath initializer

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/webviews/apps/commitDetails/stateProvider.ts Adds context-backed state provider handling IPC notifications and preference/mode mutations
src/webviews/apps/commitDetails/context.ts Defines lit context for sharing serialized state
src/webviews/apps/commitDetails/components/gl-commit-details.ts Fixes import source for uncommittedSha constant
src/webviews/apps/commitDetails/components/commit-details-app.ts Removes legacy root component (logic migrated)
src/webviews/apps/commitDetails/commitDetails.ts Implements new root app host with integrated event wiring and state interactions
src/webviews/apps/commitDetails/commitDetails.html Updates element initialization with explicit attributes and injects resource base path script

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@eamodio eamodio added this to the 17.6 milestone Oct 3, 2025
@eamodio eamodio changed the base branch from feature/commit-details-virtualization to main October 3, 2025 22:16
@eamodio eamodio force-pushed the debt/commit-details-component-app branch from 72b0980 to e5e86e1 Compare October 3, 2025 22:18
@eamodio eamodio force-pushed the debt/commit-details-component-app branch from e5e86e1 to dc88e03 Compare October 3, 2025 22:22
@@ -1,26 +1,639 @@
/*global*/
import { Badge, defineGkElement } from '@gitkraken/shared-web-components';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see gk-badge used anywhere

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.

2 participants