Skip to content

Commit

Permalink
Remove white space from JSON while sharing to reduce link length (#23)
Browse files Browse the repository at this point in the history
Fixes #22

Minify JSON when creating sharable link and pretty print JSON when reading from query params.

* **Minify JSON when creating sharable link**
  - Update `src/App.tsx` to minify the JSON when creating the sharable link on line 199.
* **Pretty print JSON when reading from query params**
  - Update `src/App.tsx` to pretty print the JSON when reading from the query params on line 37.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/yogeshpaliyal/benchmarkify/issues/22?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
yogeshpaliyal authored Aug 29, 2024
1 parent d1bbce3 commit af6ae0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function App() {
useEffect(() => {
if (benchmarkFromRequest) {
try {
setRawInput(benchmarkFromRequest);
setRawInput(JSON.stringify(JSON.parse(benchmarkFromRequest), null, 2));
} catch (e) {
console.error(e);
}
Expand Down Expand Up @@ -200,7 +200,7 @@ function App() {
<Button
onClick={() => {
const url = new URL(window.location.href);
url.searchParams.set("benchmarks", rawInput ?? "");
url.searchParams.set("benchmarks", JSON.stringify(JSON.parse(rawInput ?? "")));
url.searchParams.set(
"filters",
JSON.stringify(filter) ?? ""
Expand Down

0 comments on commit af6ae0b

Please sign in to comment.