enhancement: lab to fetch schema if no introspection provided in inte…#7888
enhancement: lab to fetch schema if no introspection provided in inte…#7888mskorokhodov wants to merge 1 commit intomainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Laboratory component by introducing dynamic GraphQL schema fetching. It ensures that the editor always has the most current schema information, either by polling an endpoint if no static introspection is provided or if the endpoint changes, or by efficiently updating the Monaco editor's schema configuration. This improves the user experience by providing accurate auto-completion and validation without requiring a full page refresh. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
3ccf2f2 to
a122b2d
Compare
There was a problem hiding this comment.
Code Review
The pull request introduces an enhancement to fetch the schema if no introspection is provided, and refactors the Monaco GraphQL API initialization to reuse the API instance. It also removes some debug console.log statements. Overall, the changes improve the functionality and cleanliness of the code. However, there are a couple of areas that need attention regarding dependency arrays in useEffect and the aggressiveness of a polling interval.
packages/libraries/laboratory/src/components/laboratory/editor.tsx
Outdated
Show resolved
Hide resolved
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-hive/laboratory |
0.1.3-alpha-20260323212628-4f1e2f0165d974d72c083bd431675b0ae6741367 |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/render-laboratory |
0.1.3-alpha-20260323212628-4f1e2f0165d974d72c083bd431675b0ae6741367 |
npm ↗︎ unpkg ↗︎ |
hive |
10.2.1-alpha-20260323212628-4f1e2f0165d974d72c083bd431675b0ae6741367 |
npm ↗︎ unpkg ↗︎ |
a122b2d to
77fb919
Compare
|
🐋 This PR was built and pushed to the following Docker images: Targets: Platforms: Image Tag: |
77fb919 to
0551512
Compare
|
|
||
| abortController = new AbortController(); | ||
| void fetchSchema(abortController.signal); | ||
| }, 5000); |
There was a problem hiding this comment.
An arbitrary timeout of 5 seconds seems pretty restrictive for bigger GraphQL schemas, that might take a longer time to load or slow network connections. Instead, to me it seems like it might be a better approach to wait for the call to fail or complete, before scheduling the next retry interval.
0551512 to
f3bbdec
Compare
|
What is the behaviour if the introspection is explicitly disabled on the server, would that be detected and the polling is stopped? Do we provide some visual feedback to the user bout that scenario? |
f3bbdec to
4f1e2f0
Compare
Yeap, added logic to not fetch same endpoint again in case of failed response, will create new interval on endpoint update Uploading Screen Recording 2026-03-23 at 23.26.51.mov… |
…rvall
Background
Description
If schema introspection isn't provided as property to Laboratory, lab will start interval to fetch schema every second.
Screen.Recording.2026-03-20.at.10.00.06.mov
Checklist