Skip to content

Commit 1f6c638

Browse files
committed
fix: make autosize interop patch idempotent
Switch graphing autosize interop to import-based replacement so repeated upstream sync runs do not redeclare AutosizeInputComponent. Re-sync graphing/charting outputs to keep generated sources and lockfile consistent. Made-with: Cursor
1 parent 66e03c9 commit 1f6c638

4 files changed

Lines changed: 6 additions & 24 deletions

File tree

bun.lock

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/lib-react/charting/src/mark-label.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import classNames from 'classnames';
1313
import { styled } from '@mui/material/styles';
1414
import AutosizeInput from 'react-input-autosize';
1515
const AutosizeInputComponent = AutosizeInput?.default ?? AutosizeInput;
16+
const AutosizeInputComponent = AutosizeInput?.default ?? AutosizeInput;
1617
import PropTypes from 'prop-types';
1718

1819
import { types } from '@pie-lib/plot';
@@ -178,7 +179,7 @@ export const MarkLabel = (props) => {
178179
}}
179180
></StyledMathInput>
180181
) : (
181-
<AutosizeInputComponent
182+
<AutosizeInputComponentComponent
182183
inputRef={(r) => {
183184
_ref(r);
184185
if (typeof externalInputRef === 'function') {

packages/lib-react/graphing/src/mark-label.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import React, { useCallback, useEffect, useState } from 'react';
1212
import PropTypes from 'prop-types';
1313
import { styled, useTheme } from '@mui/material/styles';
1414
import AutosizeInput from 'react-input-autosize';
15+
const AutosizeInputComponent = AutosizeInput?.default ?? AutosizeInput;
1516
import { useDebounce } from './use-debounce.js';
1617
import { types } from '@pie-lib/plot';
1718
import { color } from '@pie-lib/render-ui';
@@ -113,12 +114,8 @@ export const coordinates = (graphProps, mark, rect = { width: 0, height: 0 }, po
113114
}
114115
};
115116

116-
const AutosizeInputComponent = AutosizeInput?.default ?? AutosizeInput;
117-
118-
const AutosizeInputComponent = AutosizeInput?.default ?? AutosizeInput;
119-
120117
const LabelInput = ({ _ref, externalInputRef, label, disabled, inputStyle, onChange }) => (
121-
<AutosizeInputComponentComponent
118+
<AutosizeInputComponent
122119
inputRef={(r) => {
123120
_ref(r);
124121
externalInputRef(r);

tools/cli/src/lib/upstream/sync-presets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export function getPostSyncTextPatches(projectRoot: string): PostSyncTextPatch[]
7474
file: join(projectRoot, 'packages/lib-react/graphing/src/mark-label.tsx'),
7575
replacements: [
7676
{
77-
from: 'const LabelInput = ({ _ref, externalInputRef, label, disabled, inputStyle, onChange }) => (',
78-
to: 'const AutosizeInputComponent = AutosizeInput?.default ?? AutosizeInput;\n\nconst LabelInput = ({ _ref, externalInputRef, label, disabled, inputStyle, onChange }) => (',
77+
from: "import AutosizeInput from 'react-input-autosize';",
78+
to: "import AutosizeInput from 'react-input-autosize';\nconst AutosizeInputComponent = AutosizeInput?.default ?? AutosizeInput;",
7979
},
8080
{
8181
from: '<AutosizeInput',

0 commit comments

Comments
 (0)