-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add request and module details to context (#544)
Ref #543 ![image](https://github.com/user-attachments/assets/407865d6-0e21-4608-8f8a-56f4948306c7) --------- Co-authored-by: Shubhdeep Chhabra <[email protected]>
- Loading branch information
1 parent
ab5181c
commit 2e4d90c
Showing
10 changed files
with
124 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@spotlightjs/spotlight': minor | ||
'@spotlightjs/overlay': minor | ||
--- | ||
|
||
Add request and module details to context with JSONViewer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ dist-ssr | |
*.sln | ||
*.sw? | ||
|
||
.astro | ||
.yalc | ||
yalc.lock | ||
.vite-inspect | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/// <reference path="../.astro/types.d.ts" /> | ||
/// <reference types="astro/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/// <reference path="../.astro/types.d.ts" /> | ||
/// <reference types="astro/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import ReactJson from 'react-json-view'; | ||
|
||
// Need this separately to fix Storybook 8 bundling | ||
// See #419 and #420 for more context | ||
const noop = () => {}; | ||
|
||
function shouldCollapse({ src, type }: { src: Array<unknown> | object; type: string }) { | ||
if (type === 'object') return Object.keys(src).length > 10; | ||
if (type === 'array') return (src as Array<unknown>).length > 10; | ||
return false; | ||
} | ||
|
||
export default function JsonViewer({ | ||
data, | ||
onUpdateData = noop, | ||
editingEnabled = false, | ||
clipboardEnabled = true, | ||
displayDataTypes = false, | ||
quotesOnKeys = false, | ||
name = null, | ||
collapseStringsAfterLength = 80, | ||
}: { | ||
data: object; | ||
onUpdateData?: (value: unknown) => void; | ||
editingEnabled?: boolean; | ||
clipboardEnabled?: boolean; | ||
displayDataTypes?: boolean; | ||
quotesOnKeys?: boolean; | ||
name?: string | null | false; | ||
collapseStringsAfterLength?: number; | ||
}) { | ||
return ( | ||
<ReactJson | ||
theme="bright" | ||
displayDataTypes={displayDataTypes} | ||
quotesOnKeys={quotesOnKeys} | ||
shouldCollapse={shouldCollapse} | ||
collapseStringsAfterLength={collapseStringsAfterLength} | ||
name={name} | ||
src={data} | ||
enableClipboard={clipboardEnabled} | ||
onEdit={ | ||
editingEnabled && | ||
(e => { | ||
if (e.new_value === 'error') { | ||
return false; | ||
} | ||
onUpdateData(e.updated_src); | ||
}) | ||
} | ||
onDelete={ | ||
editingEnabled && | ||
(e => { | ||
if (e.new_value === 'error') { | ||
return false; | ||
} | ||
onUpdateData(e.updated_src); | ||
}) | ||
} | ||
onAdd={ | ||
editingEnabled && | ||
(e => { | ||
if (e.new_value === 'error') { | ||
return false; | ||
} | ||
onUpdateData(e.updated_src); | ||
}) | ||
} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
packages/overlay/src/integrations/sentry/components/developerInfo/JsonViewer.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters