Skip to content

fix(website): update hash value if problem occurs due to ts version error #11292

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions packages/website/src/components/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function Playground(): React.JSX.Element {
onMarkersChange={setMarkers}
onSelect={setPosition}
selectedRange={selectedRange}
setState={setState}
/>
</Panel>
<PanelResizeHandle className={styles.PanelResizeHandle} />
Expand Down
9 changes: 8 additions & 1 deletion packages/website/src/components/editor/useSandboxServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import semverSatisfies from 'semver/functions/satisfies';
import type { createTypeScriptSandbox } from '../../vendor/sandbox';
import type { CreateLinter } from '../linter/createLinter';
import type { PlaygroundSystem } from '../linter/types';
import type { RuleDetails } from '../types';
import type { ConfigModel, RuleDetails } from '../types';
import type { CommonEditorProps } from './types';

import rootPackageJson from '../../../../../package.json';
Expand All @@ -23,6 +23,7 @@ export interface SandboxServicesProps {
ruleDetails: RuleDetails[],
tsVersions: readonly string[],
) => void;
readonly setState: (value: Partial<ConfigModel>) => void;
readonly ts: string;
}

Expand Down Expand Up @@ -140,6 +141,12 @@ export const useSandboxServices = (
})
.catch((err: unknown) => {
if (err instanceof Error) {
if (
err.message ===
'Could not get all the dependencies of sandbox set up!'
) {
props.setState({ ts: process.env.TS_VERSION });
}
setServices(err);
} else {
setServices(new Error(String(err)));
Expand Down