Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exportImage(), exportSvg() fails with "Export function called before canvas loaded" #179

Open
dhe128 opened this issue Dec 5, 2024 · 0 comments

Comments

@dhe128
Copy link

dhe128 commented Dec 5, 2024

const svgCanvas = React.createRef<CanvasRef>();

exportSvg() sometimes throws with Export function called before canvas loaded because svgCanvas.current is null - this is due to the usage of createRef which creates a new ref every time the component is rendered.

Suggested fix: replace createRef with useRef

@dhe128 dhe128 changed the title Use useRef over createRef exportImage(), exportSvg() fails with "Export function called before canvas loaded" Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant