Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix the ts version selected by the user #305

Merged
merged 9 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Repl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ defineExpose({ reload })
margin: 0;
overflow: hidden;
font-size: 13px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This may be due to version differences.

Please confirm whether to use pnpm@9 install.
Or undo this irrelevant modification. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I've already changed it

Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background-color: var(--bg-soft);
}

Expand Down
5 changes: 3 additions & 2 deletions src/output/srcdoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
color-scheme: dark;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
</style>
<!-- PREVIEW-OPTIONS-HEAD-HTML -->
Expand Down
3 changes: 3 additions & 0 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export function useStore(
}
}
if (vueVersion.value) files._version = vueVersion.value
if (typescriptVersion.value) files._tsVersion = typescriptVersion.value
Copy link
Collaborator

Choose a reason for hiding this comment

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

🤔 I wonder if typescriptVersion === latest can be ignored ?
By default, all data may have a _tsVersion file.
But the default vueVersion is null.

Copy link
Contributor Author

@huangmingfu huangmingfu Feb 19, 2025

Choose a reason for hiding this comment

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

No, if the ts version is not transmitted, request 404.

const store = (window.store = useStore(
  {
    //  ...
    // typescriptVersion: ref('4.9.3')
  },
  location.hash,
))

image

My latest submission has solved this problem.
image
It is similar to the writing of vue version request.
image

return '#' + utoa(JSON.stringify(files))
}
const deserialize: ReplStore['deserialize'] = (
Expand All @@ -289,6 +290,8 @@ export function useStore(
for (const filename in saved) {
if (filename === '_version') {
vueVersion.value = saved[filename]
} else if (filename === '_tsVersion') {
typescriptVersion.value = saved[filename]
} else {
setFile(files.value, filename, saved[filename])
}
Expand Down