Skip to content

Commit

Permalink
fix: share url not working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
okikio authored Nov 15, 2021
1 parent ef7f310 commit 3c0ae3f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
24 changes: 16 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/ts/modules/monaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ export const parseTreeshakeExports = (str: string) =>
* - `treeshake` represents the exports to treeshake. Read more about this here, {@link parseTreeshakeExports}
* - `share` represents all other code that isn't export/import
*/
export const parseSearchQuery = (oldShareURL: URL) => {
export const parseSearchQuery = (shareURL: URL) => {
try {
const searchParams = oldShareURL.searchParams;
const searchParams = shareURL.searchParams;
let plaintext = searchParams.get("text");
if (plaintext) return plaintext;

Expand All @@ -158,7 +158,7 @@ export const parseSearchQuery = (oldShareURL: URL) => {
let treeshake = searchParams.get("treeshake");
if (query) {
let queryArr = query.trim().split(",");
let treeshakeArr = parseTreeshakeExports(treeshake.trim());
let treeshakeArr = parseTreeshakeExports((treeshake ?? "").trim());
result += (
"// Click Run for the Bundled + Minified + Gzipped package size\n" +
queryArr
Expand Down Expand Up @@ -432,7 +432,7 @@ export const build = (oldShareURL: URL) => {
[
'// Click Run for the Bundled + Minified + Gzipped package size',
'export * from "@okikio/animate";',
].join("\n")
].join("\n");

let inputEl = document.querySelector(".app#input #editor") as HTMLElement;
let outputEl = document.querySelector(".app#output #editor") as HTMLElement;
Expand Down

1 comment on commit 3c0ae3f

@vercel
Copy link

@vercel vercel bot commented on 3c0ae3f Nov 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.