The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: Escape new lines for DocsSearch (#22655)
Osama Akhtar6d165f45d8ad
diff --git a/packages/ui-patterns/Cmdk/Command.utils.tsx b/packages/ui-patterns/Cmdk/Command.utils.tsxindex 28e15f06c99..d9c1683873a 100644--- a/packages/ui-patterns/Cmdk/Command.utils.tsx+++ b/packages/ui-patterns/Cmdk/Command.utils.tsx@@ -6,7 +6,7 @@ import { cn } from 'ui/src/lib/utils'import { AlertTriangle } from 'lucide-react'import { DetailedHTMLProps, HTMLAttributes, KeyboardEventHandler } from 'react'-import { DialogContent, Dialog } from 'ui'+import { Dialog, DialogContent } from 'ui'import { Button } from 'ui/src/components/Button'import { LoadingLine } from 'ui/src/components/LoadingLine/LoadingLine'import { useCommandMenu } from './CommandMenuProvider'@@ -23,10 +23,6 @@ export const copyToClipboard = (str: string, callback = () => {}) => {}}-export function escapeDoubleQuotes(str: string) {- return str.replaceAll('"', '\\"')-}-export const Command = React.forwardRef<CommandPrimitiveElement, CommandPrimitiveProps>(({ className, ...props }, ref) => (<CommandPrimitivediff --git a/packages/ui-patterns/Cmdk/DocsSearch.tsx b/packages/ui-patterns/Cmdk/DocsSearch.tsxindex ec3444ec1f6..0efc2a5ae6b 100644--- a/packages/ui-patterns/Cmdk/DocsSearch.tsx+++ b/packages/ui-patterns/Cmdk/DocsSearch.tsx@@ -1,8 +1,9 @@+import { compact, debounce, uniqBy } from 'lodash'import * as React from 'react'import { useCallback, useEffect, useMemo, useReducer, useRef } from 'react'-import { compact, debounce, uniqBy } from 'lodash'import { useSupabaseClient } from '@supabase/auth-helpers-react'+import { useRouter } from 'next/router'import {Button,IconAlertTriangle,@@ -13,14 +14,7 @@ import {IconMessageSquare,IconSearch,} from 'ui'-import {- CommandGroup,- CommandItem,- CommandLabel,- TextHighlighter,- escapeDoubleQuotes,-} from './Command.utils'-import { useRouter } from 'next/router'+import { CommandGroup, CommandItem, CommandLabel, TextHighlighter } from './Command.utils'import { useCommandMenu } from './CommandMenuProvider'const NUMBER_SOURCES = 2@@ -416,12 +410,12 @@ const DocsSearch = () => {<CommandGroupheading=""key={`${page.path}-group`}- value={`${escapeDoubleQuotes(page.title)}-group-index-${i}`}+ value={`${encodeURIComponent(page.title)}-group-index-${i}`}forceMount={true}><CommandItemkey={`${page.path}-item`}- value={`${escapeDoubleQuotes(page.title)}-item-index-${i}`}+ value={`${encodeURIComponent(page.title)}-item-index-${i}`}type="block-link"onSelect={() => {openLink(page.type, formatPageUrl(page))@@ -456,9 +450,9 @@ const DocsSearch = () => {openLink(page.type, formatSectionUrl(page, section))}}key={`${page.path}__${section.heading}-item`}- value={`${escapeDoubleQuotes(+ value={`${encodeURIComponent(page.title- )}__${escapeDoubleQuotes(section.heading)}-item-index-${i}`}+ )}__${encodeURIComponent(section.heading)}-item-index-${i}`}forceMount={true}type="block-link">