added lazy boundary reset

This commit is contained in:
Nate Kelley 2025-09-24 22:39:25 -06:00
parent 6309dff5f7
commit 8d8f67c545
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 297 additions and 12 deletions

View File

@ -16,17 +16,19 @@ export const LazyErrorBoundary: React.FC<React.PropsWithChildren> = ({ children
<ErrorBoundary <ErrorBoundary
fallbackRender={() => { fallbackRender={() => {
if (isChanged) { if (isChanged) {
return ( window.location.reload();
<ComponentErrorCard return null;
highlightType="info" // return (
message="The app has been updated. Please reload the page." // <ComponentErrorCard
title="New version available" // highlightType="info"
buttonText="Reload" // message="The app has been updated. Please reload the page."
onButtonClick={() => { // title="New version available"
navigate({ reloadDocument: true }); // buttonText="Reload"
}} // onButtonClick={() => {
/> // navigate({ reloadDocument: true });
); // }}
// />
// );
} }
return ( return (

View File

@ -2630,3 +2630,286 @@ export const WithQuarterAndYearXAxis: Story = {
}, },
}, },
}; };
export const WithQuarterNumber: Story = {
args: {
colors: [
'#B399FD',
'#FC8497',
'#FBBC30',
'#279EFF',
'#E83562',
'#41F8FF',
'#F3864F',
'#C82184',
'#31FCB4',
'#E83562',
],
barLayout: 'vertical',
barSortBy: [],
goalLines: [],
gridLines: true,
pieSortBy: 'value',
showLegend: null,
trendlines: [],
scatterAxis: {
x: [],
y: [],
size: [],
tooltip: null,
category: [],
},
barGroupType: 'group',
metricHeader: null,
pieChartAxis: {
x: [],
y: [],
tooltip: null,
},
lineGroupType: null,
pieDonutWidth: 40,
xAxisDataZoom: false,
barAndLineAxis: {
x: ['year', 'quarter'],
y: ['avg_gross_margin'],
tooltip: null,
category: [],
},
columnSettings: {},
comboChartAxis: {
x: [],
y: [],
y2: [],
tooltip: null,
category: [],
},
disableTooltip: false,
metricColumnId: '',
scatterDotSize: [3, 15],
xAxisAxisTitle: null,
yAxisAxisTitle: null,
yAxisScaleType: 'linear',
metricSubHeader: null,
y2AxisAxisTitle: null,
y2AxisScaleType: 'linear',
metricValueLabel: null,
pieLabelPosition: 'none',
tableColumnOrder: null,
barShowTotalAtTop: false,
categoryAxisTitle: null,
pieDisplayLabelAs: 'number',
pieShowInnerLabel: true,
selectedChartType: 'line',
tableColumnWidths: null,
xAxisTimeInterval: null,
columnLabelFormats: {
year: {
isUTC: false,
style: 'number',
prefix: '',
suffix: '',
currency: 'USD',
columnType: 'number',
dateFormat: 'auto',
multiplier: 1,
displayName: '',
compactNumbers: false,
convertNumberTo: null,
useRelativeTime: false,
numberSeparatorStyle: null,
maximumFractionDigits: 2,
minimumFractionDigits: 0,
makeLabelHumanReadable: true,
replaceMissingDataWith: 0,
},
quarter: {
isUTC: false,
style: 'number',
prefix: '',
suffix: '',
currency: 'USD',
columnType: 'number',
dateFormat: 'auto',
multiplier: 1,
displayName: '',
compactNumbers: false,
convertNumberTo: 'quarter',
useRelativeTime: false,
numberSeparatorStyle: null,
maximumFractionDigits: 2,
minimumFractionDigits: 0,
makeLabelHumanReadable: true,
replaceMissingDataWith: 0,
},
negative_count: {
isUTC: false,
style: 'number',
prefix: '',
suffix: '',
currency: 'USD',
columnType: 'number',
dateFormat: 'auto',
multiplier: 1,
displayName: 'Negative Products',
compactNumbers: false,
convertNumberTo: null,
useRelativeTime: false,
numberSeparatorStyle: ',',
maximumFractionDigits: 2,
minimumFractionDigits: 0,
makeLabelHumanReadable: true,
replaceMissingDataWith: 0,
},
avg_gross_margin: {
isUTC: false,
style: 'percent',
prefix: '',
suffix: '',
currency: 'USD',
columnType: 'number',
dateFormat: 'auto',
multiplier: 1,
displayName: 'Average Gross Margin',
compactNumbers: false,
convertNumberTo: null,
useRelativeTime: false,
numberSeparatorStyle: ',',
maximumFractionDigits: 1,
minimumFractionDigits: 1,
makeLabelHumanReadable: true,
replaceMissingDataWith: 0,
},
},
pieInnerLabelTitle: null,
showLegendHeadline: false,
xAxisLabelRotation: 'auto',
xAxisShowAxisLabel: true,
xAxisShowAxisTitle: true,
yAxisShowAxisLabel: true,
yAxisShowAxisTitle: true,
y2AxisShowAxisLabel: true,
y2AxisShowAxisTitle: true,
metricValueAggregate: 'sum',
tableColumnFontColor: null,
tableHeaderFontColor: null,
yAxisStartAxisAtZero: null,
y2AxisStartAxisAtZero: true,
pieInnerLabelAggregate: 'sum',
pieMinimumSlicePercentage: 0,
tableHeaderBackgroundColor: null,
columnMetadata: [
{
name: 'year',
min_value: 2022,
max_value: 2025,
unique_values: 4,
simple_type: 'number',
type: 'numeric',
},
{
name: 'quarter',
min_value: 1,
max_value: 4,
unique_values: 4,
simple_type: 'number',
type: 'numeric',
},
{
name: 'avg_gross_margin',
min_value: -15.38538138267754,
max_value: 13.535758480065276,
unique_values: 13,
simple_type: 'number',
type: 'numeric',
},
{
name: 'negative_count',
min_value: 0,
max_value: 37,
unique_values: 9,
simple_type: 'number',
type: 'int8',
},
],
data: [
{
year: 2022,
quarter: 3,
avg_gross_margin: 5.104114056564919,
negative_count: 13,
},
{
year: 2022,
quarter: 4,
avg_gross_margin: 1.8996067873773883,
negative_count: 17,
},
{
year: 2023,
quarter: 1,
avg_gross_margin: 2.3518147641617744,
negative_count: 17,
},
{
year: 2023,
quarter: 2,
avg_gross_margin: 2.253994159993576,
negative_count: 17,
},
{
year: 2023,
quarter: 3,
avg_gross_margin: -15.38538138267754,
negative_count: 37,
},
{
year: 2023,
quarter: 4,
avg_gross_margin: -0.37097575793903026,
negative_count: 17,
},
{
year: 2024,
quarter: 1,
avg_gross_margin: 1.4841226527352336,
negative_count: 14,
},
{
year: 2024,
quarter: 2,
avg_gross_margin: 1.6647203835444542,
negative_count: 15,
},
{
year: 2024,
quarter: 3,
avg_gross_margin: -4.72213972473674,
negative_count: 28,
},
{
year: 2024,
quarter: 4,
avg_gross_margin: 5.114081768462615,
negative_count: 17,
},
{
year: 2025,
quarter: 1,
avg_gross_margin: 13.535758480065276,
negative_count: 0,
},
{
year: 2025,
quarter: 2,
avg_gross_margin: 10.910645447490767,
negative_count: 6,
},
{
year: 2025,
quarter: 3,
avg_gross_margin: 11.49792588896277,
negative_count: 5,
},
],
},
};

View File

@ -8,7 +8,7 @@ export const useWelcomeConsole = () => {
'background: linear-gradient(to right, #a21caf, #8b1cb1, #6b21a8); color: white; font-size: 16px; font-weight: bold; padding: 10px; border-radius: 5px;' 'background: linear-gradient(to right, #a21caf, #8b1cb1, #6b21a8); color: white; font-size: 16px; font-weight: bold; padding: 10px; border-radius: 5px;'
); );
console.log( console.log(
`%c🐛 Found a bug? The code is open-source! Report it at https://github.com/buster-so/buster or send a PR! 🚀 • This version was deployed at ${formatDate({ date: import.meta.env.VITE_BUILD_AT, format: 'LLLL' })}`, `%c🐛 Found a bug? The code is open-source! Report it at https://github.com/buster-so/buster or send a PR! 🚀 • This version was deployed on ${formatDate({ date: import.meta.env.VITE_BUILD_AT, format: 'LLL' })}`,
'background: #6b21a8; color: white !important; font-size: 10px; font-weight: 500; padding: 8px 12px; border-radius: 5px; text-decoration: none; --webkit-text-fill-color: white; --webkit-text-stroke-color: white;' 'background: #6b21a8; color: white !important; font-size: 10px; font-weight: 500; padding: 8px 12px; border-radius: 5px; text-decoration: none; --webkit-text-fill-color: white; --webkit-text-stroke-color: white;'
); );
}); });