Skip to content

Commit

Permalink
Merge pull request #535 from pixijs/520-bug-events-on-a-sprite-dont-w…
Browse files Browse the repository at this point in the history
…ork-on-initial-run-using-vite

Restore `draw` method being run for `<graphics>` components
  • Loading branch information
trezy authored Sep 1, 2024
2 parents 86b833d + f7a0eb7 commit e808f22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/constants/PixiReactIgnoredProps.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { PixiToReactEventPropNames } from './EventPropNames';

export const PixiReactIgnoredProps = Object.freeze(Object.keys(PixiToReactEventPropNames));
export const PixiReactIgnoredProps = Object.freeze([
...Object.keys(PixiToReactEventPropNames),
'draw',
]);
3 changes: 2 additions & 1 deletion src/helpers/createInstance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ReactToPixiEventPropNames } from '../constants/EventPropNames';
import { PixiReactIgnoredProps } from '../constants/PixiReactIgnoredProps';
import { applyProps } from './applyProps';
import { catalogue } from './catalogue';
import { convertStringToPascalCase } from './convertStringToPascalCase';
Expand Down Expand Up @@ -30,7 +31,7 @@ export function createInstance(
// Get the class from an imported Pixi.js namespace
const PixiComponent = catalogue[name];

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

// Clone event props
Object.entries(props).forEach(([key, value]) =>
Expand Down
3 changes: 1 addition & 2 deletions src/helpers/gentleCloneProps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { PixiReactIgnoredProps } from '../constants/PixiReactIgnoredProps';
import { ReactIgnoredProps } from '../constants/ReactIgnoredProps';
import { gentleClone } from './gentleClone';

Expand All @@ -8,5 +7,5 @@ export function gentleCloneProps(
additionalIgnoredProps: readonly string[] = [],
)
{
return gentleClone(props, ReactIgnoredProps.concat(PixiReactIgnoredProps, additionalIgnoredProps));
return gentleClone(props, ReactIgnoredProps.concat(additionalIgnoredProps));
}

0 comments on commit e808f22

Please sign in to comment.