Skip to content

Commit

Permalink
fix: make sure VictoryPortal id does not change between re-renders (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gustaff-weldon authored Oct 24, 2024
1 parent 8f2804f commit 5e94c61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-melons-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"victory-core": minor
---

Fix VictoryPortal id changing for every render
4 changes: 2 additions & 2 deletions packages/victory-core/src/victory-portal/victory-portal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useState } from "react";
import { defaults, uniqueId } from "lodash";
import * as Log from "../victory-util/log";
import * as Helpers from "../victory-util/helpers";
Expand All @@ -15,7 +15,7 @@ const defaultProps: Partial<VictoryPortalProps> = {

export const VictoryPortal = (initialProps: VictoryPortalProps) => {
const props = { ...defaultProps, ...initialProps };
const id = uniqueId();
const [id] = useState(uniqueId());
const portalContext = usePortalContext();

if (!portalContext) {
Expand Down

0 comments on commit 5e94c61

Please sign in to comment.