Skip to content

Bug - Decorator - Cannot destructure property 'addDef' of 'undefined' as it is undefined #290

@aptmac

Description

@aptmac

Describe the problem
Hi! I'm trying to add a decorator to a OpenShift Console dynamic plugin for use in their Topology page(s), but I'm running into the following error message when using the Decorator: TypeError: Cannot destructure property 'addDef' of 'undefined' as it is undefined

Example snippet: <Decorator x={x} y={y} radius={radius}></Decorator>

My dev console is pointing here: https://github.com/patternfly/react-topology/blob/main/packages/module/src/components/defs/SVGDefs.tsx#L27

How do you reproduce the problem?

I've put together a branch to illustrate this: https://github.com/aptmac/console-plugin-template/tree/example-decorator

It's an OpenShift dynamic plugin, so you'll need a running instance of OpenShift or CRC to test against.

  1. In one terminal, install and run the plugin: yarn install && yarn run start
  2. In another terminal, run a local console frontend: yarn run start-console
  3. Have a running deployment. Quickest way would be to go to the Developer perspective -> +Add page, and under "Create applications using samples" select "Basic Quarkus" and follow the steps to create
  4. Go to the Topology page, and try to view the new deployment

The expected behaviour is that a new decorator should be present in the top left of the deployment node. The actual behaviour is the error message above.

Expected behavior
A clear and concise description of the expected behavior.

Is this issue blocking you?
List the workaround if there is one.

Screenshots

Actual: here's a screenshot of the error
Image

Expected: I'm expecting a decorator and icon to be drawn in the top left of the node. Here I replaced the <Decorator> and used the icon directly instead and it appears, but it would look nicer with the decorator around it
Image

What is your environment?

  • OS: Fedora 42
  • Browser: Chrome
  • Version: 140.0.7339.80

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions