redhat-developer / redhat-developer/vscode-openshift-tools

Refactor webviews to avoid code duplication

Open
#3,074 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debt
Dominant language
TypeScript
Stars
123
Forks
63
Avg merge
6h 16m
Merged PRs (30d)
74

Description

Here are a few ideas:

  • Create an abstract base class for the view loaders. This enables a few things:
    • We can add a base message handler that is used for all the webviews. This allows us to reuse implementations of message handlers that should be used in all the views, such as sending telemetry and initializing the color scheme when the webview becomes available
    • We can come up with a cleaner way to add and reuse message handlers. For example, many of the message handlers for create component and devfile registry overlap, so it would be nice to reuse them
  • We can create as base wrapper component for each of the webviews that contains:
    • The ThemeProvider component and the message passing code in order to manage the theme (light vs dark mode)
    • An error boundary component in order to handle when a webview crashes due to a fault in our React code

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by locating the webview loaders, message handlers, and existing ThemeProvider usage, then compare the create component and devfile registry views. Done means shared loader or wrapper behavior covers common message handling, telemetry, theme initialization, and React error boundaries without duplicating those implementations.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, vscode
Domain
frontend, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.