Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/app/.oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"scripts/**"
],
"rules": {
"typescript/no-unsafe-function-type": "warn",
"typescript/no-unsafe-function-type": "error",
"typescript/no-unsafe-type-assertion": "warn",
"no-unused-expressions": "warn",
"no-console": [
Expand Down Expand Up @@ -116,7 +116,7 @@
"nextjs/no-duplicate-head": "error",
"nextjs/no-head-import-in-document": "error",
"nextjs/no-script-component-in-head": "error",
"@eslint-react/jsx-key-before-spread": "warn",
"@eslint-react/jsx-key-before-spread": "error",
"@eslint-react/jsx-no-comment-textnodes": "warn",
"@eslint-react/no-access-state-in-setstate": "error",
"@eslint-react/no-array-index-key": "warn",
Expand All @@ -125,7 +125,7 @@
"@eslint-react/no-children-map": "warn",
"@eslint-react/no-children-only": "warn",
"@eslint-react/no-children-to-array": "warn",
"@eslint-react/no-clone-element": "warn",
"@eslint-react/no-clone-element": "error",
"@eslint-react/no-component-will-mount": "error",
"@eslint-react/no-component-will-receive-props": "error",
"@eslint-react/no-component-will-update": "error",
Expand All @@ -141,10 +141,10 @@
"@eslint-react/no-unsafe-component-will-mount": "warn",
"@eslint-react/no-unsafe-component-will-receive-props": "warn",
"@eslint-react/no-unsafe-component-will-update": "warn",
"@eslint-react/no-unnecessary-use-prefix": "warn",
"@eslint-react/no-unnecessary-use-prefix": "error",
"@eslint-react/no-unused-class-component-members": "warn",
"@eslint-react/no-use-context": "error",
"@eslint-react/use-state": "warn",
"@eslint-react/use-state": "error",
"@eslint-react/rsc/function-definition": "error",
"@eslint-react/dom/no-dangerously-set-innerhtml": "warn",
"@eslint-react/dom/no-dangerously-set-innerhtml-with-children": "error",
Expand All @@ -163,7 +163,7 @@
"@eslint-react/web-api/no-leaked-resize-observer": "warn",
"@eslint-react/web-api/no-leaked-timeout": "warn",
"@eslint-react/naming-convention/context-name": "warn",
"@eslint-react/naming-convention/id-name": "warn",
"@eslint-react/naming-convention/id-name": "error",
"@eslint-react/naming-convention/ref-name": "error",
"@eslint-react/no-unstable-default-props": "error",
"react-hook-form/no-use-watch": "error",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build:clickhouse": "NEXT_PUBLIC_IS_LOCAL_MODE=true NEXT_PUBLIC_CLICKHOUSE_BUILD=true next build --webpack && node scripts/prepare-clickhouse-build-export.js",
"run:clickhouse": "test -d out && npx rimraf tmp && mkdir tmp && cp -r out tmp/clickstack && echo 'visit http://localhost:3000/clickstack to start' && npx serve tmp -l 3000 || echo 'run build:clickhouse first'",
"start": "next start",
"lint": "node ../../scripts/ci/oxlint-warnings.mjs --max-warnings 569 && yarn run -T oxfmt --check '**/*.{ts,tsx,css,scss}'",
"lint": "node ../../scripts/ci/oxlint-warnings.mjs --max-warnings 534 && yarn run -T oxfmt --check '**/*.{ts,tsx,css,scss}'",
"lint:fix": "yarn run -T oxlint --fix && yarn run -T oxfmt '**/*.{ts,tsx,css,scss}'",
"lint:styles": "stylelint **/*/*.{css,scss}",
"ci:lint": "yarn lint && yarn tsc --noEmit && yarn lint:styles --quiet",
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/DBSearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ function DBSearchPageContent() {
setNewSourceModalOpened(true);
}, []);

const [isDrawerChildModalOpen, setDrawerChildModalOpen] = useState(false);
const [isDrawerChildModalOpen, setIsDrawerChildModalOpen] = useState(false);

const rowTableContext = useMemo(
() => ({
Expand All @@ -2335,7 +2335,7 @@ function DBSearchPageContent() {
generateSearchUrl,
dbSqlRowTableConfig,
isChildModalOpen: isDrawerChildModalOpen,
setChildModalOpen: setDrawerChildModalOpen,
setChildModalOpen: setIsDrawerChildModalOpen,
source: searchedSource,
}),
[
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/DOMPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ export default function DOMPlayer({
const initialEventsRef = useRef<any[]>([]);

const lastEventTsLoadedRef = useRef(0);
const [lastEventTsLoaded, _setLastEventTsLoaded] = useState(0);
const [lastEventTsLoaded, setLastEventTsLoaded] = useState(0);
const setLastEventTsLoadedRef = useRef(
throttle(_setLastEventTsLoaded, 100, { leading: true, trailing: true }),
throttle(setLastEventTsLoaded, 100, { leading: true, trailing: true }),
);
const [isInitialEventsLoaded, setIsInitialEventsLoaded] = useState(false);
const [isReplayFullyLoaded, setIsReplayFullyLoaded] = useState(false);
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/HDXMultiSeriesTimeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1484,8 +1484,8 @@ export const MemoChart = memo(function MemoChart({
*/
yAxisMaxDomain?: number;
}) {
const _id = useId();
const id = _id.replace(/:/g, '');
const reactId = useId();
const id = reactId.replace(/:/g, '');

// The y-axis width budget is expressed in characters (see MAX_AXIS_MANTISSA),
// so it has to grow with the tick font or the widest labels clip.
Expand Down
2 changes: 0 additions & 2 deletions packages/app/src/KubernetesDashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,6 @@ function KubernetesDashboardPage() {

const whereClause = searchQuery;

const [_searchQuery, _setSearchQuery] = React.useState<string | null>(null);

const { data: logSourceJsonColumns, isLoading: isLoadingJsonColumns } =
useJsonColumns(
logSource && {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/NamespaceDetailsSidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ export default function NamespaceDetailsSidePanel(props: {

return (
<NamespaceDetailsSidePanelInner
{...props}
key={namespaceName || 'empty'}
{...props}
namespaceName={namespaceName}
setNamespaceName={setNamespaceName}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/NodeDetailsSidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ export default function NodeDetailsSidePanel(props: {

return (
<NodeDetailsSidePanelInner
{...props}
key={nodeName || 'empty'}
{...props}
nodeName={nodeName}
setNodeName={setNodeName}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/PodDetailsSidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ export default function PodDetailsSidePanel(props: {

return (
<PodDetailsSidePanelInner
{...props}
key={podName || 'empty'}
{...props}
podName={podName}
setPodName={setPodName}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ function ServicesDashboardPage() {
});

// For future use if Live button is added
const [isLive, _setIsLive] = useState(false);
const isLive = false;

const { manualRefreshCooloff, refresh } = useDashboardRefresh({
searchedTimeRange,
Expand Down
30 changes: 14 additions & 16 deletions packages/app/src/SessionSubpanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,7 @@ export default function SessionSubpanel({
);
const prevTsQuery = usePrevious(tsQuery);

const [focus, _setFocus] = useState<
{ ts: number; setBy: string } | undefined
>(
const [focus, setFocus] = useState<{ ts: number; setBy: string } | undefined>(
initialTs != null
? {
ts: initialTs,
Expand All @@ -257,7 +255,7 @@ export default function SessionSubpanel({

useEffect(() => {
if (prevTsQuery == null && tsQuery != null) {
_setFocus({ ts: tsQuery, setBy: 'url' });
setFocus({ ts: tsQuery, setBy: 'url' });
}
}, [prevTsQuery, tsQuery]);

Expand All @@ -273,16 +271,16 @@ export default function SessionSubpanel({
};
}, [setTsQuery]);

const setFocus = useCallback(
const updateFocus = useCallback(
(focus: { ts: number; setBy: string }) => {
if (focus.setBy === 'player') {
debouncedSetTsQuery(focus.ts);
} else {
setTsQuery(focus.ts);
}
_setFocus(focus);
setFocus(focus);
},
[_setFocus, setTsQuery, debouncedSetTsQuery],
[setFocus, setTsQuery, debouncedSetTsQuery],
);
const [playerState, setPlayerState] = useState<'paused' | 'playing'>(
'paused',
Expand Down Expand Up @@ -400,18 +398,18 @@ export default function SessionSubpanel({
}, [setPlayerState]);

const skipBackward = useCallback(() => {
setFocus({
updateFocus({
ts: Math.max((focus?.ts ?? minTs) - 15000, minTs),
setBy: 'skip-backward',
});
}, [setFocus, focus?.ts, minTs]);
}, [updateFocus, focus?.ts, minTs]);

const skipForward = useCallback(() => {
setFocus({
updateFocus({
ts: Math.min((focus?.ts ?? minTs) + 15000, maxTs),
setBy: 'skip-forward',
});
}, [setFocus, focus?.ts, minTs, maxTs]);
}, [updateFocus, focus?.ts, minTs, maxTs]);

const { control, handleSubmit } = useForm({
values: {
Expand All @@ -433,17 +431,17 @@ export default function SessionSubpanel({
);
const onSessionEventTimeClick = useCallback(
(ts: number) => {
setFocus({ ts, setBy: 'timeline' });
updateFocus({ ts, setBy: 'timeline' });
},
[setFocus],
[updateFocus],
);
const setPlayerTime = useCallback(
(ts: number) => {
if (focus?.setBy !== 'player' || focus?.ts !== ts) {
setFocus({ ts, setBy: 'player' });
updateFocus({ ts, setBy: 'player' });
}
},
[focus, setFocus],
[focus, updateFocus],
);

return (
Expand Down Expand Up @@ -538,7 +536,7 @@ export default function SessionSubpanel({
playerState={playerState}
setPlayerState={setPlayerState}
focus={focus}
setFocus={setFocus}
setFocus={updateFocus}
playbackRange={playbackRange}
queriedConfig={eventsConfig}
logEvents={logEvents.events}
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/ContextSidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function ContextSubpanel({
const origTimestamp = rowData[ROW_DATA_ALIASES.TIMESTAMP];
const { whereLanguage: originalLanguage = 'lucene' } =
dbSqlRowTableConfig ?? {};
const [range, setRange] = useState<number>(ms('30s'));
const [range, setRange] = useState<number>(() => ms('30s'));
const [activePreset, setActivePreset] = useState('all');
const { control, reset } = useForm({
defaultValues: {
Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/components/DBDeltaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export default function DBDeltaChart({
isPriorityProperty,
]);

const [activePage, setPage] = useState(1);
const [activePage, setActivePage] = useState(1);

const {
ref: containerRef,
Expand All @@ -440,7 +440,7 @@ export default function DBDeltaChart({
),
);
useEffect(() => {
setPage(1);
setActivePage(1);
}, [columns, rows, xMin, xMax, yMin, yMax]);

if (error) {
Expand Down Expand Up @@ -669,7 +669,7 @@ export default function DBDeltaChart({
<Pagination
size="xs"
value={activePage}
onChange={setPage}
onChange={setActivePage}
total={totalPages}
/>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/DBRowOverviewPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ export function RowOverviewPanel({
<Flex wrap="wrap" gap="2px" mx={contentPx} mb="lg">
{Object.entries(resourceAttributes).map(([key, value]) => (
<EventTag
key={key}
{...(onPropertyAddClick
? {
onPropertyAddClick,
Expand All @@ -523,7 +524,6 @@ export function RowOverviewPanel({
displayedKey={key}
name={`${'resourceAttributesExpression' in source ? source.resourceAttributesExpression : ''}.${key}`}
value={value as string}
key={key}
/>
))}
</Flex>
Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/components/DBSearchPageFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,10 @@ const FilterGroupBody = ({
}) => {
const [search, setSearch] = useState('');
// "Show More" button when there's lots of options
const [shouldShowMore, setShowMore] = useState(false);
const [shouldShowMore, setShouldShowMore] = useState(false);
// Track recently moved items for highlight animation
const [recentlyMoved, setRecentlyMoved] = useState<Set<string | boolean>>(
new Set(),
() => new Set(),
);
// For live searches, don't refresh percentages when date range changes
const [dateRange, setDateRange] = useState<[Date, Date]>(
Expand Down Expand Up @@ -770,7 +770,7 @@ const FilterGroupBody = ({
}
onClick={() => {
// When show more is clicked, immediately show all and also fetch more from server.
setShowMore(!shouldShowMore);
setShouldShowMore(!shouldShowMore);
if (!shouldShowMore) {
onLoadMore?.(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const NestedFilterGroup = ({
);

const hasSelections = totalFiltersSize > 0;
const [isExpanded, setExpanded] = useState(
const [isExpanded, setIsExpanded] = useState(
isDefaultExpanded ?? hasSelections,
);

Expand Down Expand Up @@ -151,7 +151,7 @@ export const NestedFilterGroup = ({
chevronPosition="left"
classNames={{ chevron: classes.chevron }}
value={isExpanded ? name : null}
onChange={v => setExpanded(v === name)}
onChange={v => setIsExpanded(v === name)}
>
<Accordion.Item value={name} data-testid={dataTestId}>
<div className={classes.filterGroup}>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/DBTimeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ function DBTimeChartComponent({
applySelectColors = false,
}: DBTimeChartComponentProps) {
const [selectedSeriesSet, setSelectedSeriesSet] = useState<Set<string>>(
new Set(),
() => new Set(),
);

// When the render cap hides series, the hidden-series notice lets the user
Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/components/DBTraceWaterfallChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,9 @@ export function DBTraceWaterfallChartContainer({
aliasWith: WithClause[];
};

const [collapsedIds, setCollapsedIds] = useState<Set<string>>(new Set());
const [collapsedIds, setCollapsedIds] = useState<Set<string>>(
() => new Set(),
);

const { nodesMap, flattenedNodes, parentIdsByLevel } = useMemo(() => {
const rootNodes: Node[] = [];
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/components/ExceptionSubpanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import {
import { ColumnDef, Row, Table as TanstackTable } from '@tanstack/react-table';

import { CopySnippet } from '@/components/ClickStackOnboarding/CopySnippet';
import { getSourceMappedFrame } from '@/sourceMappedFrame';
import type {
StacktraceBreadcrumb,
StacktraceFrame as TStacktraceFrame,
} from '@/types';
import { FormatTime } from '@/useFormatTime';
import { useSourceMappedFrame } from '@/useSourceMappedFrame';
import { UNKNOWN_FUNCTION } from '@/utils/sentryStackParser';

import { Table, TableCellButton } from './Table';
Expand Down Expand Up @@ -210,7 +210,7 @@ const StacktraceRow = ({

const frame = row.original;

const { isLoading, enrichedFrame } = useSourceMappedFrame();
const { isLoading, enrichedFrame } = getSourceMappedFrame();

const augmentedFrame = enrichedFrame ?? frame;
const hasContext = !!augmentedFrame.context_line;
Expand Down
Loading
Loading