Skip to content

Commit fadc986

Browse files
committed
refactor: remove deprecated cloud plan handling from gatsby-ssr.js and useCloudPlan.ts
- Eliminated the cloud plan script from gatsby-ssr.js, streamlining the rendering process. - Removed the GLOBAL_STATE_CLOUD_PLAN_KEY constant from useCloudPlan.ts to enhance code clarity and maintainability.
1 parent 58c67b2 commit fadc986

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

gatsby-ssr.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export { default as wrapRootElement } from "./src/state/wrap-with-provider";
22
import { CLOUD_PLAN_LABEL_ELEMENT_ID } from "components/Layout/VersionSelect/CloudVersionSelect";
33
import docsJson from "./docs/docs.json";
4-
import { GLOBAL_STATE_CLOUD_PLAN_KEY } from "./src/shared/useCloudPlan";
54

65
// https://github.com/gatsbyjs/gatsby/issues/1526
76
export const onPreRenderHTML = ({ getHeadComponents }) => {
@@ -81,16 +80,6 @@ const redirectScript = `
8180
})();
8281
`;
8382

84-
const cloudPlanScript = `
85-
(function() {
86-
const searchParams = new URLSearchParams(location.search);
87-
const cloudMode = searchParams.get("plan");
88-
if (cloudMode) {
89-
window["${GLOBAL_STATE_CLOUD_PLAN_KEY}"] = cloudMode;
90-
}
91-
})();
92-
`;
93-
9483
const fulfillCloudPlanScript = `
9584
(function() {
9685
const searchParams = new URLSearchParams(location.search);
@@ -136,10 +125,6 @@ export const onRenderBody = ({ setPostBodyComponents, setHeadComponents }) => {
136125
type="font/woff2"
137126
crossOrigin="anonymous"
138127
/>,
139-
<script
140-
key="cloud-plan"
141-
dangerouslySetInnerHTML={{ __html: cloudPlanScript }}
142-
/>,
143128
]);
144129
setPostBodyComponents([
145130
<script key="deprecated" dangerouslySetInnerHTML={{ __html: script }} />,

src/shared/useCloudPlan.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import { Repo } from "./interface";
1212
export const CLOUD_MODE_KEY = "plan";
1313
export const CLOUD_MODE_VALUE_STARTER = "starter";
1414
export const CLOUD_MODE_VALUE_ESSENTIAL = "essential";
15-
export const GLOBAL_STATE_CLOUD_PLAN_KEY =
16-
"__TIDB_DOCS_GLOBAL_STATE_CLOUD_PLAN__";
1715

1816
const CloudPlanContext = createContext<{
1917
repo: Repo;

0 commit comments

Comments
 (0)