File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @hyperdx/app " : patch
3+ ---
4+
5+ fix issue where new lines are not persisted to url params correctly
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ import OnboardingModal from './components/OnboardingModal';
6666import { Tags } from './components/Tags' ;
6767import useDashboardFilters from './hooks/useDashboardFilters' ;
6868import { useDashboardRefresh } from './hooks/useDashboardRefresh' ;
69+ import { parseAsStringWithNewLines } from './utils/queryParsers' ;
6970import api from './api' ;
7071import { DEFAULT_CHART_CONFIG } from './ChartUtils' ;
7172import { IS_LOCAL_MODE } from './config' ;
@@ -557,7 +558,7 @@ function DBDashboardPage({ presetConfig }: { presetConfig?: Dashboard }) {
557558 ) as [ SQLInterval | undefined , ( value : SQLInterval | undefined ) => void ] ;
558559 const [ where , setWhere ] = useQueryState (
559560 'where' ,
560- parseAsString . withDefault ( '' ) ,
561+ parseAsStringWithNewLines . withDefault ( '' ) ,
561562 ) ;
562563 const [ whereLanguage , setWhereLanguage ] = useQueryState (
563564 'whereLanguage' ,
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ import PatternTable from './components/PatternTable';
104104import SourceSchemaPreview from './components/SourceSchemaPreview' ;
105105import { useTableMetadata } from './hooks/useMetadata' ;
106106import { useSqlSuggestions } from './hooks/useSqlSuggestions' ;
107+ import { parseAsStringWithNewLines } from './utils/queryParsers' ;
107108import api from './api' ;
108109import { LOCAL_STORE_CONNECTIONS_KEY } from './connection' ;
109110import { DBSearchPageAlertModal } from './DBSearchPageAlertModal' ;
@@ -590,11 +591,11 @@ export function useDefaultOrderBy(sourceID: string | undefined | null) {
590591// This is outside as it needs to be a stable reference
591592const queryStateMap = {
592593 source : parseAsString ,
593- where : parseAsString ,
594- select : parseAsString ,
594+ where : parseAsStringWithNewLines ,
595+ select : parseAsStringWithNewLines ,
595596 whereLanguage : parseAsStringEnum < 'sql' | 'lucene' > ( [ 'sql' , 'lucene' ] ) ,
596597 filters : parseAsJson < Filter [ ] > ( ) ,
597- orderBy : parseAsString ,
598+ orderBy : parseAsStringWithNewLines ,
598599} ;
599600
600601function DBSearchPage ( ) {
Original file line number Diff line number Diff line change 1+ import { createParser } from 'nuqs' ;
2+
3+ // Note: this can be deleted once we upgrade to nuqs v2.2.3
4+ // https://github.com/47ng/nuqs/pull/783
5+ export const parseAsStringWithNewLines = createParser < string > ( {
6+ parse : value => value . replace ( / % 0 A / g, '\n' ) ,
7+ serialize : value => value . replace ( / \n / g, '%0A' ) ,
8+ } ) ;
You can’t perform that action at this time.
0 commit comments