diff --git a/static/app/views/explore/logs/useLogsQueryTruncate.spec.tsx b/static/app/views/explore/logs/useLogsQueryTruncate.spec.tsx index 43ab72941f2420..83d8fa663d5d53 100644 --- a/static/app/views/explore/logs/useLogsQueryTruncate.spec.tsx +++ b/static/app/views/explore/logs/useLogsQueryTruncate.spec.tsx @@ -18,11 +18,11 @@ describe('useLogsQueryTruncate', () => { it('rounds the formula result up to the next power of two', () => { mockUseWindowSize.mockReturnValue({innerWidth: 6400, innerHeight: 1080}); const {result} = renderHookWithProviders(() => useLogsQueryTruncate()); - expect(result.current).toBe(512); + expect(result.current).toBe(1024); }); it('returns the exact value when the formula result is already a power of two', () => { - mockUseWindowSize.mockReturnValue({innerWidth: 4096, innerHeight: 1080}); + mockUseWindowSize.mockReturnValue({innerWidth: 3072, innerHeight: 1080}); const {result} = renderHookWithProviders(() => useLogsQueryTruncate()); expect(result.current).toBe(256); }); @@ -30,30 +30,30 @@ describe('useLogsQueryTruncate', () => { it('does not shrink the truncation length when the viewport shrinks', () => { mockUseWindowSize.mockReturnValue({innerWidth: 6400, innerHeight: 1080}); const {result, rerender} = renderHookWithProviders(() => useLogsQueryTruncate()); - expect(result.current).toBe(512); + expect(result.current).toBe(1024); mockUseWindowSize.mockReturnValue({innerWidth: 3200, innerHeight: 1080}); rerender(); - expect(result.current).toBe(512); + expect(result.current).toBe(1024); }); it('does not recompute when the viewport grows within the same power of two', () => { mockUseWindowSize.mockReturnValue({innerWidth: 3200, innerHeight: 1080}); const {result, rerender} = renderHookWithProviders(() => useLogsQueryTruncate()); - expect(result.current).toBe(256); + expect(result.current).toBe(512); - mockUseWindowSize.mockReturnValue({innerWidth: 4096, innerHeight: 1080}); + mockUseWindowSize.mockReturnValue({innerWidth: 6000, innerHeight: 1080}); rerender(); - expect(result.current).toBe(256); + expect(result.current).toBe(512); }); it('grows the truncation length when the viewport grows past the next power of two', () => { - mockUseWindowSize.mockReturnValue({innerWidth: 4096, innerHeight: 1080}); + mockUseWindowSize.mockReturnValue({innerWidth: 3200, innerHeight: 1080}); const {result, rerender} = renderHookWithProviders(() => useLogsQueryTruncate()); - expect(result.current).toBe(256); + expect(result.current).toBe(512); mockUseWindowSize.mockReturnValue({innerWidth: 8192, innerHeight: 1080}); rerender(); - expect(result.current).toBe(512); + expect(result.current).toBe(1024); }); }); diff --git a/static/app/views/explore/logs/useLogsQueryTruncate.tsx b/static/app/views/explore/logs/useLogsQueryTruncate.tsx index 52ea723f53d467..a7945802e0af0f 100644 --- a/static/app/views/explore/logs/useLogsQueryTruncate.tsx +++ b/static/app/views/explore/logs/useLogsQueryTruncate.tsx @@ -4,7 +4,7 @@ import {useWindowSize} from 'sentry/utils/window/useWindowSize'; export function useLogsQueryTruncate(): number { const {innerWidth} = useWindowSize(); - const target = Math.max(128, Math.floor(innerWidth / 16)); + const target = Math.max(128, Math.floor(innerWidth / 12)); // Round up to the next power of two so small viewport changes don't shift the // truncation length and trigger a re-query.