Skip to content

Commit

Permalink
update pcb viewer, fix alternate registry handling (again- with speci…
Browse files Browse the repository at this point in the history
…al CORS handling) (#506)

* update pcb viewer, fix alternate registry handling (again- with special CORS handling)

* update pcb viewer

* update pcb viewer

* update pcb viewer to more esm friendly version

* update pcb viewer
  • Loading branch information
seveibar authored Jan 8, 2025
1 parent d6ab2ae commit 965ca3d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Binary file modified bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@tscircuit/footprinter": "^0.0.99",
"@tscircuit/layout": "^0.0.29",
"@tscircuit/mm": "^0.0.8",
"@tscircuit/pcb-viewer": "^1.10.22",
"@tscircuit/pcb-viewer": "^1.11.12",
"@tscircuit/props": "^0.0.128",
"@tscircuit/schematic-viewer": "^1.4.3",
"@types/file-saver": "^2.0.7",
Expand Down Expand Up @@ -114,7 +114,7 @@
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"use-async-memo": "^1.2.5",
"use-mouse-matrix-transform": "^1.1.13",
"use-mouse-matrix-transform": "^1.3.0",
"vaul": "^0.9.9",
"wouter": "^3.3.5"
},
Expand Down
6 changes: 5 additions & 1 deletion src/components/CodeAndPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,13 @@ export function CodeAndPreview({ snippet }: Props) {
)
return response.data
} catch (error: any) {
const responseStatus = error?.status ?? error?.response?.status
// We would normally only do this if the error is a 413, but we're not
// able to check the status properly because of the browser CORS policy
// (the PAYLOAD_TOO_LARGE error does not have the proper CORS headers)
if (
import.meta.env.VITE_ALTERNATE_REGISTRY_URL &&
error.status === 413
(responseStatus === undefined || responseStatus === 413)
) {
console.log(`Failed to update snippet, attempting alternate registry`)
const response = await axios.post(
Expand Down

0 comments on commit 965ca3d

Please sign in to comment.