Skip to content

Extensions stop working after refresh #62

Description

@SamNugget

When using a custom extension, if you refresh chrome with dev tools open, the custom extension does not work until dev tools is reopened;

To reproduce, use this custom extension:

import { ButtonMetadata, ExtensionMetadata, PixiMetadata, TreeExtension } from "@pixi/devtools";
import { Container } from "pixi.js";

export class SceneTreeExtension implements TreeExtension
{
    readonly extension = {
        type: "sceneTree"
        //name?: string | undefined
        //priority?: number | undefined
    } as ExtensionMetadata;
    
    updateNodeMetadata?(node: Container, metadata: PixiMetadata): PixiMetadata {
        return metadata;
    }
    onButtonPress?: ((container: Container, name: string, pressed?: boolean) => void) | undefined;
    onContextButtonPress?: ((container: Container, contextMenuName: string) => void) | undefined;
    onRename?: ((container: Container, newName: string) => void) | undefined;
    onDeleted?: ((container: Container) => void) | undefined;
    onSwap?: ((container: Container, newIndex: number) => void) | undefined;

    public onSelected(/*container: Container*/): void
    {
        console.log("Selected!");
    }

    panelButtons?: ButtonMetadata[] | undefined;
}

Create devtools like so:

    initDevtools({
        pixi: PIXI,
        extensions: [new SceneTreeExtension()],
        app: app
    });

When a new page is opened, and dev tools is opened, it works and prints "Selected!" to the console.
Refreshing the page (with dev tools open) will cause the custom extension to not work unless dev tools is reopened, or until a new window is opened. The tool works normally, so can cause the user to proceed without realizing their custom extension is not working.

A workaround is to call, but I think this should be handled elsewhere.
window.__PIXI_DEVTOOLS_WRAPPER__?.reset();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions