-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
RND-2311: enums for server url in openapi block #2452
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 8d1c349 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
be799b1
to
c84cf3d
Compare
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
c84cf3d
to
cde6f2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick first pass, I think we should abstract the concept of enum you are introducing here (enum is also a confusing name btw), to also be used for other client states that the block needs.
packages/gitbook/src/app/(space)/(content)/[[...pathname]]/page.tsx
Outdated
Show resolved
Hide resolved
ec4c412
to
d28d46b
Compare
@@ -6,7 +6,8 @@ | |||
"types": "./dist/index.d.ts", | |||
"development": "./src/index.ts", | |||
"default": "./dist/index.js" | |||
} | |||
}, | |||
"./client": "./src/client.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exporting the client component separately here because I found that If I add a client component (OpenAPIContextProvider) to the /src/index
file it has the unfortunate side effect of turning all the server components exported in that file into client components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it work if you put 'use server'
at the top of the other file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will that do anything? I thought use server
was the default and use client
is the only directive that really does anything, at the top of a file at least.
0d7e4b6
to
2b7ea27
Compare
89ca24c
to
9573535
Compare
…tbook into brett/RND-2311-openapi-enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a LOT more comments to explain the relationship and the flow of things? Right now the PR is quite complex and and hard to diggest; it's hard to validate how it'll impact server/client components without understanding the flow of data you ate trying to put in place.
@@ -6,7 +6,8 @@ | |||
"types": "./dist/index.d.ts", | |||
"development": "./src/index.ts", | |||
"default": "./dist/index.js" | |||
} | |||
}, | |||
"./client": "./src/client.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it work if you put 'use server'
at the top of the other file?
type OpenAPIContextProps = { | ||
isPending?: boolean; | ||
serverUrl?: string; | ||
state?: Record<string, string> | null; | ||
onUpdate: (params: Record<string, string> | null) => void; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document these props, I have no idea what they mean (isPending
, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
|
||
export function OpenAPIContextProvider(props: { | ||
children: React.ReactNode; | ||
data: OpenAPIOperationData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing the data
here goes against the whole server component approach. This means we'll include the OpenAPI operation data for every element in HTML, resulting in very big HTML output.
}} | ||
className="openapi-block" | ||
/> | ||
<OpenAPIContext block={block} data={data}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we not supposed to have a onUpdate
here?
With this PR, open api schemas with an array of servers and variables for server urls will allow selection of the variables and choice of server.
Updating code samples and scalar modal's server url when updated. Which fixes Issue #2432
CleanShot.2024-09-12.at.17.11.32.mp4