diff --git a/static/app/components/core/drawer/components.tsx b/static/app/components/core/drawer/components.tsx index d517e6622d52..a021dbcac8da 100644 --- a/static/app/components/core/drawer/components.tsx +++ b/static/app/components/core/drawer/components.tsx @@ -35,7 +35,7 @@ export function useDrawerContentContext() { /** * Rendering props for the inner DrawerPanel component. Inherits the shared * panel-configuration props directly from DrawerOptions so the two interfaces - * can't drift. GlobalDrawer-only options (onOpen, shouldClose*, onClose + * can't drift. GlobalDrawer-only options (shouldClose*, onClose * callback) are consumed before reaching this component. */ interface DrawerPanelProps extends Pick< diff --git a/static/app/components/core/drawer/index.tsx b/static/app/components/core/drawer/index.tsx index d4fa4413b2f7..dc9dccbca951 100644 --- a/static/app/components/core/drawer/index.tsx +++ b/static/app/components/core/drawer/index.tsx @@ -51,10 +51,6 @@ export interface DrawerOptions { * Callback for when the drawer closes */ onClose?: () => void; - /** - * Callback for when the drawer opens - */ - onOpen?: () => void; /** * If true (default), allows the drawer to be resized - requires `drawerKey` * to be defined @@ -137,7 +133,6 @@ export function GlobalDrawer({children}: any) { scrollLock.acquire(); } overwriteDrawerConfig({renderer, options, callerId}); - options.onOpen?.(); }, [scrollLock] ); diff --git a/static/app/components/core/table/table.mdx b/static/app/components/core/table/table.mdx index ed9123b87d0f..160cc7460603 100644 --- a/static/app/components/core/table/table.mdx +++ b/static/app/components/core/table/table.mdx @@ -76,8 +76,7 @@ Omit it to size the column with `minmax(minimumColumnWidth, auto)`, and set `res ``` -Widths are uncontrolled by default, and the component tracks them per column key. -Pass `onColumnResize` to control them instead, which is how `GridEditable` persists widths to the URL. +Widths are uncontrolled, and the component tracks them per column key. ## Status Rows diff --git a/static/app/components/core/table/table.spec.tsx b/static/app/components/core/table/table.spec.tsx index 79f97c0ad65c..4c9ea3fbb97b 100644 --- a/static/app/components/core/table/table.spec.tsx +++ b/static/app/components/core/table/table.spec.tsx @@ -7,7 +7,7 @@ import { within, } from 'sentry-test/reactTestingLibrary'; -import {COL_WIDTH_UNDEFINED, Table, type TableColumnConfig} from '@sentry/scraps/table'; +import {Table, type TableColumnConfig} from '@sentry/scraps/table'; const COLUMNS: TableColumnConfig[] = [ {key: 'name', width: 200}, @@ -135,13 +135,12 @@ describe('Table', () => { await waitFor(() => expect(gridTemplate()).toBe('90px 150px minmax(90px, auto)')); }); - it('reports the final width to onColumnResize when a drag ends', () => { - const onColumnResize = jest.fn(); - render(); + it('keeps the resized width after a drag ends', async () => { + render(); dragHandle(resizers()[1]!, {from: 100, to: 350}); - expect(onColumnResize).toHaveBeenCalledWith(1, 250); + await waitFor(() => expect(gridTemplate()).toBe('200px 250px minmax(90px, auto)')); }); it('retains the resized width when no onColumnResize is provided', async () => { @@ -164,15 +163,6 @@ describe('Table', () => { ); }); - it('reports an undefined width to onColumnResize when a handle is double-clicked', async () => { - const onColumnResize = jest.fn(); - render(); - - await userEvent.dblClick(resizers()[0]!); - - expect(onColumnResize).toHaveBeenCalledWith(0, COL_WIDTH_UNDEFINED); - }); - it('places a resize handle in the tab order', async () => { render(); @@ -201,22 +191,20 @@ describe('Table', () => { }); it('commits a resize when a focused handle is arrowed', async () => { - const onColumnResize = jest.fn(); - render(); + render(); await userEvent.tab(); await userEvent.keyboard('{ArrowRight}'); - expect(onColumnResize).toHaveBeenCalledWith(0, 90); + await waitFor(() => expect(gridTemplate()).toBe('90px 150px minmax(90px, auto)')); }); it('does not commit a resize when a handle is right-clicked', () => { - const onColumnResize = jest.fn(); - render(); + render(); dragHandle(resizers()[0]!, {button: 2, from: 100, to: 400}); - expect(onColumnResize).not.toHaveBeenCalled(); + expect(gridTemplate()).toBe('200px 150px minmax(90px, auto)'); }); it('keeps the in-progress width when an unrelated re-render lands mid-drag', async () => { diff --git a/static/app/components/core/table/table.tsx b/static/app/components/core/table/table.tsx index 9d30a800f44b..395dbd48c811 100644 --- a/static/app/components/core/table/table.tsx +++ b/static/app/components/core/table/table.tsx @@ -107,7 +107,6 @@ export interface TableProps extends Omit< columns?: TableColumnConfig[]; flexibleLastColumn?: boolean; minimumColumnWidth?: number; - onColumnResize?: (index: number, width: number) => void; prependColumnWidths?: string[]; ref?: RefObject; } @@ -117,7 +116,6 @@ export function Table({ columns = EMPTY_COLUMNS, flexibleLastColumn = true, minimumColumnWidth = COL_WIDTH_MINIMUM, - onColumnResize, prependColumnWidths, ref, ...props @@ -126,12 +124,11 @@ export function Table({ const gridRef = ref ?? internalRef; const [internalWidths, setInternalWidths] = useState>({}); - const isControlled = !!onColumnResize; const resolveWidth = useCallback( (column: TableColumnConfig): ResolvedWidth => - isControlled ? column.width : (internalWidths[column.key] ?? column.width), - [internalWidths, isControlled] + internalWidths[column.key] ?? column.width, + [internalWidths] ); const buildTemplate = useCallback( @@ -159,13 +156,11 @@ export function Table({ (index: number, width: number) => { const key = columns[index]?.key; - if (onColumnResize) { - onColumnResize(index, width); - } else if (key) { + if (key) { setInternalWidths(current => ({...current, [key]: width})); } }, - [columns, onColumnResize] + [columns] ); const getResizeTemplate = useCallback( diff --git a/static/app/components/modals/createTeamModal.spec.tsx b/static/app/components/modals/createTeamModal.spec.tsx index 3025a5728448..ae069554d331 100644 --- a/static/app/components/modals/createTeamModal.spec.tsx +++ b/static/app/components/modals/createTeamModal.spec.tsx @@ -11,7 +11,6 @@ import CreateTeamModal from 'sentry/components/modals/createTeamModal'; describe('CreateTeamModal', () => { const org = OrganizationFixture(); const closeModal = jest.fn(); - const onClose = jest.fn(); beforeEach(() => { jest.clearAllMocks(); @@ -34,7 +33,6 @@ describe('CreateTeamModal', () => { Header={p => {p.children}} organization={org} closeModal={closeModal} - onClose={onClose} CloseButton={makeCloseButton(() => {})} /> ); @@ -47,7 +45,6 @@ describe('CreateTeamModal', () => { `/organizations/${org.slug}/teams/`, expect.objectContaining({data: {slug: 'new-team'}}) ); - expect(onClose).toHaveBeenCalledWith(team); expect(closeModal).toHaveBeenCalled(); }); }); diff --git a/static/app/components/modals/createTeamModal.tsx b/static/app/components/modals/createTeamModal.tsx index 1938d1499e0d..7edeeeae6c1e 100644 --- a/static/app/components/modals/createTeamModal.tsx +++ b/static/app/components/modals/createTeamModal.tsx @@ -16,7 +16,6 @@ import {slugify} from 'sentry/utils/slugify'; interface Props extends ModalRenderProps { organization: Organization; - onClose?: (team: Team) => void; } const schema = z.object({ @@ -28,7 +27,6 @@ function CreateTeamModal({ Footer, Header, organization, - onClose, closeModal, }: Props) { const {mutateAsync: submitCreateTeam} = useMutation({ @@ -49,7 +47,6 @@ function CreateTeamModal({ }) ); closeModal(); - onClose?.(team); }, onError: (_err, variables) => { addErrorMessage( diff --git a/static/app/components/onboarding/createSampleEventButton.tsx b/static/app/components/onboarding/createSampleEventButton.tsx index 60e9a8429c27..a16e7c72a373 100644 --- a/static/app/components/onboarding/createSampleEventButton.tsx +++ b/static/app/components/onboarding/createSampleEventButton.tsx @@ -22,7 +22,6 @@ import {useOrganization} from 'sentry/utils/useOrganization'; type CreateSampleEventButtonProps = ButtonProps & { source: string; hasScmOnboarding?: boolean; - onClick?: () => void; project?: Project; }; @@ -32,7 +31,6 @@ const EVENT_POLL_INTERVAL = 1000; export function CreateSampleEventButton({ source, hasScmOnboarding, - onClick, project, ...buttonProps }: CreateSampleEventButtonProps) { @@ -129,8 +127,6 @@ export function CreateSampleEventButton({ source, }); - onClick?.(); - navigate( normalizeUrl( `/organizations/${organization.slug}/issues/${groupID}/?project=${project!.id}&referrer=sample-error` diff --git a/static/app/components/pageFilters/project/projectPageFilter.spec.tsx b/static/app/components/pageFilters/project/projectPageFilter.spec.tsx index 9aabd7cd9efc..98fb0383015e 100644 --- a/static/app/components/pageFilters/project/projectPageFilter.spec.tsx +++ b/static/app/components/pageFilters/project/projectPageFilter.spec.tsx @@ -161,8 +161,7 @@ describe('ProjectPageFilter', () => { }); it('handles reset', async () => { - const onReset = jest.fn(); - const {router} = render(, { + const {router} = render(, { organization, initialRouterConfig: { location: {pathname: '/organizations/org-slug/issues/', query: {}}, @@ -178,9 +177,7 @@ describe('ProjectPageFilter', () => { await userEvent.click(screen.getByRole('button', {name: 'project-1'})); await userEvent.click(screen.getByRole('button', {name: 'Reset'})); - // Trigger button was updated, onReset was called expect(screen.getByRole('button', {name: 'My Projects'})).toBeInTheDocument(); - expect(onReset).toHaveBeenCalled(); }); it('responds to page filter changes, async e.g. from back button nav', async () => { diff --git a/static/app/components/pageFilters/project/projectPageFilter.tsx b/static/app/components/pageFilters/project/projectPageFilter.tsx index b15a9be0a472..a0b9929df6b8 100644 --- a/static/app/components/pageFilters/project/projectPageFilter.tsx +++ b/static/app/components/pageFilters/project/projectPageFilter.tsx @@ -49,10 +49,6 @@ export interface ProjectPageFilterProps extends Partial< * Called when the selection changes */ onChange?: (selected: number[]) => void; - /** - * Called when the reset button is clicked - */ - onReset?: () => void; /** * Reset these URL params when we fire actions (custom routing only) */ @@ -66,7 +62,6 @@ export interface ProjectPageFilterProps extends Partial< export function ProjectPageFilter({ onChange, - onReset, disabled, menuTitle, menuWidth, @@ -497,7 +492,6 @@ export function ProjectPageFilter({ const handleReset = () => { clearDraftSelectionState(); commitSelection(memberProjectIds(projects)); - onReset?.(); trackAnalytics('projectselector.clear', { path: routePath, diff --git a/static/app/components/timeSince.spec.tsx b/static/app/components/timeSince.spec.tsx index 2c475944011a..6319f16dc1bb 100644 --- a/static/app/components/timeSince.spec.tsx +++ b/static/app/components/timeSince.spec.tsx @@ -39,21 +39,11 @@ describe('TimeSince', () => { expect(screen.getByText('10 minutes')).toBeInTheDocument(); }); - it('renders a relative date without prefix', () => { - render(); - expect(screen.getByText('10 minutes')).toBeInTheDocument(); - }); - it('renders a custom suffix', () => { render(); expect(screen.getByText('10 minutes until lunch')).toBeInTheDocument(); }); - it('renders a custom prefix', () => { - render(); - expect(screen.getByText('lunch is in 10 minutes')).toBeInTheDocument(); - }); - it('renders a custom suffix with shortened', () => { render(); expect(screen.getByText('10m atrás')).toBeInTheDocument(); diff --git a/static/app/components/timeSince.tsx b/static/app/components/timeSince.tsx index cd785f74dbe2..4b77c37db37f 100644 --- a/static/app/components/timeSince.tsx +++ b/static/app/components/timeSince.tsx @@ -41,12 +41,6 @@ interface Props extends Omit< * Max width of the tooltip */ maxWidth?: InfoTextProps<'time'>['maxWidth']; - /** - * Prefix before upcoming time (when the date is in the future) - * - * @default "in" - */ - prefix?: string; /** * Suffix after elapsed time e.g. "ago" in "5 minutes ago" * @@ -91,7 +85,6 @@ export function TimeSince({ variant = 'inherit', maxWidth, unitStyle, - prefix = t('in'), suffix = t('ago'), liveUpdateInterval = 'minute', ...props @@ -101,8 +94,8 @@ export function TimeSince({ const relative = useMemo(() => { void tick; // Ensure recomputation when tick changes - return getRelativeDate(date, suffix, prefix, unitStyle); - }, [date, suffix, prefix, unitStyle, tick]); + return getRelativeDate(date, suffix, t('in'), unitStyle); + }, [date, suffix, unitStyle, tick]); useEffect(() => { const interval = @@ -137,7 +130,7 @@ export function TimeSince({