>; timestamp: number } | null = null
+ if (draftQueryLocalStorage) {
+ const parsedQuery = parseDraftQueryFromLocalStorage(draftQueryLocalStorage)
+ if (parsedQuery) {
+ draftQuery = parsedQuery
+ } else {
+ localStorage.removeItem(`draft-query-${currentTeamId}`)
+ }
+ }
+
+ if (!draftQuery?.query) {
+ return <> >
+ }
+ return (
+
+ You have an unsaved insight from {new Date(draftQuery.timestamp).toLocaleString()}.{' '}
+ Click here to view it.
+
+ )
+}
diff --git a/frontend/src/scenes/saved-insights/SavedInsights.tsx b/frontend/src/scenes/saved-insights/SavedInsights.tsx
index 05f4c5c131668..bd155048b0490 100644
--- a/frontend/src/scenes/saved-insights/SavedInsights.tsx
+++ b/frontend/src/scenes/saved-insights/SavedInsights.tsx
@@ -57,6 +57,7 @@ import { NodeKind } from '~/queries/schema'
import { isNodeWithSource } from '~/queries/utils'
import { ActivityScope, InsightType, LayoutView, QueryBasedInsightModel, SavedInsightsTabs } from '~/types'
+import { ReloadInsight } from './ReloadInsight'
import { INSIGHTS_PER_PAGE, savedInsightsLogic } from './savedInsightsLogic'
interface NewInsightButtonProps {
@@ -671,6 +672,7 @@ export function SavedInsights(): JSX.Element {
) : (
<>
+
{layoutView === LayoutView.List ? (
combineUrl('/insights/new', dashboardId ? { dashboard: dashboardId } : {}, {
...(type ? { insight: type } : {}),
- ...(query ? { q: typeof query === 'string' ? query : JSON.stringify(query) } : {}),
+ // have to use JSONCrush directly rather than the util to avoid circular dep
+ ...(query ? { q: typeof query === 'string' ? query : JSONCrush.crush(JSON.stringify(query)) } : {}),
}).url,
insightNewHogQL: (query: string, filters?: HogQLFilters): string =>
combineUrl(
diff --git a/jest.config.ts b/jest.config.ts
index 53e5df5943413..39ab8232a5592 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -8,7 +8,7 @@ process.env.TZ = process.env.TZ || 'UTC'
* https://jestjs.io/docs/en/configuration.html
*/
-const esmModules = ['query-selector-shadow-dom', 'react-syntax-highlighter', '@react-hook', '@medv', 'monaco-editor']
+const esmModules = ['query-selector-shadow-dom', 'react-syntax-highlighter', '@react-hook', '@medv', 'monaco-editor', 'jsoncrush']
const eeFolderExists = fs.existsSync('ee/frontend/exports.ts')
function rootDirectories() {
const rootDirectories = ['/frontend/src']
diff --git a/package.json b/package.json
index 64abf39fe9892..7dfc6b33f2a21 100644
--- a/package.json
+++ b/package.json
@@ -140,6 +140,7 @@
"hls.js": "^1.5.15",
"husky": "^7.0.4",
"image-blob-reduce": "^4.1.0",
+ "jsoncrush": "^1.1.8",
"kea": "^3.1.5",
"kea-forms": "^3.2.0",
"kea-loaders": "^3.0.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c8e2b60ea24d2..cabf935d23bd6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -241,6 +241,9 @@ dependencies:
image-blob-reduce:
specifier: ^4.1.0
version: 4.1.0
+ jsoncrush:
+ specifier: ^1.1.8
+ version: 1.1.8
kea:
specifier: ^3.1.5
version: 3.1.5(react@18.2.0)
@@ -15412,6 +15415,10 @@ packages:
resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==}
dev: true
+ /jsoncrush@1.1.8:
+ resolution: {integrity: sha512-lvIMGzMUA0fjuqwNcxlTNRq2bibPZ9auqT/LyGdlR5hvydJtA/BasSgkx4qclqTKVeTidrJvsS/oVjlTCPQ4Nw==}
+ dev: false
+
/jsonfile@6.1.0:
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
dependencies:
@@ -18520,7 +18527,7 @@ packages:
react: '>=15'
dependencies:
react: 18.2.0
- unlayer-types: 1.182.0
+ unlayer-types: 1.185.0
dev: false
/react-error-boundary@3.1.4(react@18.2.0):
@@ -21107,8 +21114,8 @@ packages:
resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==}
engines: {node: '>= 10.0.0'}
- /unlayer-types@1.182.0:
- resolution: {integrity: sha512-x+YSeA7/Wb/znKDtRws8M3Mu6TyKP3d+MddPVX/iUyDPVEOapoPWk0QxjIaNYtWt6troADZdhzgr2EwsZ61HrA==}
+ /unlayer-types@1.185.0:
+ resolution: {integrity: sha512-GP5JbjJ1sqxEeAHh5QrOJXEg3os3qyuuN04IVo7pNr3uY14p5CfTkWh+oxMIA4tWKvf69KS3B6/KSIn53fTf6A==}
dev: false
/unpipe@1.0.0: