From 0d4c6185248da9308e42e63e31b8b908d751df6b Mon Sep 17 00:00:00 2001 From: Paddy Mullen Date: Mon, 11 Nov 2024 12:21:35 -0500 Subject: [PATCH 1/2] fixes Histograms display without fills intermittently #292 --- js/components/DFViewerParts/HistogramCell.tsx | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/js/components/DFViewerParts/HistogramCell.tsx b/js/components/DFViewerParts/HistogramCell.tsx index db355050..de76ebae 100644 --- a/js/components/DFViewerParts/HistogramCell.tsx +++ b/js/components/DFViewerParts/HistogramCell.tsx @@ -87,6 +87,15 @@ export const HistogramCell = (props: any) => { console.log('dumbClickHandler', rechartsArgs); }; + const gensym = (base: string) => { + const id = `${base}-${crypto.randomUUID()}`; + return [id, `url(#${id})`]; + }; + const [starId, starUrl] = gensym('star'); + const [stripeId, stripeUrl] = gensym('stripe'); + const [circleId, circleUrl] = gensym('circle'); + const [checkersId, checkersUrl] = gensym('checkers'); + const [leafsId, leafsUrl] = gensym('leafs'); const [screenCoords, setScreenCoords] = React.useState<{ x: number; y: number; @@ -106,7 +115,7 @@ export const HistogramCell = (props: any) => { > { /> { { { { - + - - + + + Date: Mon, 11 Nov 2024 12:26:13 -0500 Subject: [PATCH 2/2] added an explanatory comment linking back to the original bug --- js/components/DFViewerParts/HistogramCell.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/components/DFViewerParts/HistogramCell.tsx b/js/components/DFViewerParts/HistogramCell.tsx index de76ebae..7e768f00 100644 --- a/js/components/DFViewerParts/HistogramCell.tsx +++ b/js/components/DFViewerParts/HistogramCell.tsx @@ -87,6 +87,8 @@ export const HistogramCell = (props: any) => { console.log('dumbClickHandler', rechartsArgs); }; + // used to prevent duplicate IDs which lead to a nasty bug where patterns aren't applied + // https://github.com/paddymul/buckaroo/issues/292 const gensym = (base: string) => { const id = `${base}-${crypto.randomUUID()}`; return [id, `url(#${id})`];