Skip to content

Refactor webviews to avoid code duplication #3074

Open
@datho7561

Description

@datho7561

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions