Skip to content

Commit

Permalink
fix: prevent draw prop from being excluded from the diff
Browse files Browse the repository at this point in the history
  • Loading branch information
trezy committed Jun 15, 2024
1 parent 815cb8f commit a80247a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/helpers/createInstance.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PixiReactIgnoredProps } from '../constants/PixiReactIgnoredProps.js';
import { applyProps } from './applyProps.js';
import { catalogue } from './catalogue.js';
import { convertStringToPascalCase } from './convertStringToPascalCase.js';
Expand Down Expand Up @@ -30,7 +31,7 @@ export function createInstance(type, props, root)
throw new Error(`${name} is not part of the PIXI namespace! Did you forget to extend?`);
}

const pixiProps = gentleCloneProps(props);
const pixiProps = gentleCloneProps(props, PixiReactIgnoredProps);

const instance = prepareInstance(new PixiComponent(pixiProps), {
root,
Expand Down
8 changes: 3 additions & 5 deletions src/helpers/gentleCloneProps.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { PixiReactIgnoredProps } from '../constants/PixiReactIgnoredProps.js';
import { ReactIgnoredProps } from '../constants/ReactIgnoredProps.js';
import { gentleClone } from './gentleClone.js';

const IGNORED_PROPS = ReactIgnoredProps.concat(PixiReactIgnoredProps);

/**
* Clones a props object, excluding keys that are special to React and Pixi React.
*
* @param {Record<string, any>} props The props object to clone.
* @param {readonly string[]} additionalIgnoredProps Additional props to ignore.
* @returns {Record<string, any>} The cloned props.
*/
export function gentleCloneProps(props)
export function gentleCloneProps(props, additionalIgnoredProps = [])
{
return gentleClone(props, IGNORED_PROPS);
return gentleClone(props, ReactIgnoredProps.concat(additionalIgnoredProps));
}

0 comments on commit a80247a

Please sign in to comment.