Repository: pixijs/pixijs
File: src/scene/text/AbstractText.ts (TypeScript)

Code before:
    }

    public onViewUpdate()
    {
        this._didChangeId += 1 << 12;
        this._boundsDirty = true;

        if (this.didViewUpdate) return;
        this.didViewUpdate = true;

        this._didTextUpdate = true;

        const renderGroup = this.renderGroup || this.parentRenderGroup;

        if (renderGroup)
        {
            renderGroup.onChildViewUpdate(this);
        }
    }

    public _getKey(): string
    {
        if (!this.resolution)
        {
            // add rendererResolution to the key to make sure the text is re-rendered when the resolution changes
            return `${this.text}:${this._style.styleKey}-${this._rendererResolution}`;
        }

        // TODO add a dirty flag...
        return `${this.text}:${this._style.styleKey}-${this.resolution}`;
    }

    protected abstract _updateBounds(): void;

    /**
     * Destroys this text renderable and optionally its style texture.
     * @param options - Options parameter. A boolean will act as if all options
     *  have been set to that value
     * @param {boolean} [options.texture=false] - Should it destroy the texture of the text style
     * @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the text style
     * @param {boolean} [options.style=false] - Should it destroy the style of the text
     */
    public destroy(options: DestroyOptions = false): void
    {
        super.destroy(options);

        (this as any).owner = null;
        this._bounds = null;
        this._anchor = null;

        if (typeof options === 'boolean' ? options : options?.style)

Review comment (suggestion):
You could do this in a single line like this:

```ts
    return `${this.text}:${this._style.styleKey}-${this.resolution ?? this._rendererResolution}`;
```


Code after:
        return false;
    }

    public onViewUpdate()
    {
        this._didChangeId += 1 << 12;
        this._boundsDirty = true;

        if (this.didViewUpdate) return;
        this.didViewUpdate = true;

        this._didTextUpdate = true;

        const renderGroup = this.renderGroup || this.parentRenderGroup;

        if (renderGroup)
        {
            renderGroup.onChildViewUpdate(this);
        }
    }

    public _getKey(): string
    {
        return `${this.text}:${this._style.styleKey}:${this._resolution}`;
    }

    protected abstract _updateBounds(): void;

    /**
     * Destroys this text renderable and optionally its style texture.
     * @param options - Options parameter. A boolean will act as if all options
     *  have been set to that value
     * @param {boolean} [options.texture=false] - Should it destroy the texture of the text style
     * @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the text style
     * @param {boolean} [options.style=false] - Should it destroy the style of the text
     */
    public destroy(options: DestroyOptions = false): void
    {
        super.destroy(options);

        (this as any).owner = null;
        this._bounds = null;
        this._anchor = null;

        if (typeof options === 'boolean' ? options : options?.style)
        {
            this._style.destroy(options);
        }

        this._style = null;
        this._text = null;