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

GraphQL.Server.Ui.Voyager recent issues with zoom to fit #1152

Closed
nightroman opened this issue Oct 1, 2024 · 6 comments
Closed

GraphQL.Server.Ui.Voyager recent issues with zoom to fit #1152

nightroman opened this issue Oct 1, 2024 · 6 comments

Comments

@nightroman
Copy link
Contributor

nightroman commented Oct 1, 2024

The NuGet package GraphQL.Server.Ui.Voyager (the most recent 8.0.2 and older 7.7.1) started to have problems with the initial zoom to fit. The whole graph is rendered out of the screen area and it all becomes rather unusable.

I noticed this issue first on Monday but my colleague tells this started last week.

See this online example with the problem (using the package):
https://api.nexar.com/ui/voyager

and HTML copied from the above browser, with the same problem:
nexar-html-from-package.html.zip

Compare with working fine original Voyager HTML, with the same GraphQL endpoint:
nexar-voyager.html.zip
(based on the original Voyager HTML example)

@Shane32
Copy link
Member

Shane32 commented Oct 1, 2024

Here is the template that GraphQL.NET renders for the Voyager UI:

https://github.com/graphql-dotnet/server/blob/master/src/Ui.Voyager/Internal/voyager.cshtml

This file hasn't changed in 2 years; I don't know why you have two different HTML samples. In any case, it seems that it is just rendering the latest version of Voyager, as I do not see a version in the CDN reference. As such, the problem was probably caused by Voyager having released version 2.1.0 approximately 8 days ago - see https://www.npmjs.com/package/graphql-voyager?activeTab=versions.

We would accept a pull request to pin Voyager to a specific version, or changes to the file to fix the rendering bug that now occurs.

@nightroman
Copy link
Contributor Author

why you have two different HTML samples

One is from the NuGet package, it has the issue.
Another is the Voyager official example, it works fine -- https://github.com/graphql-kit/graphql-voyager/blob/main/example/cdn/index.html

NB They use different code of initializing the renderer, maybe this is essential.

@nightroman
Copy link
Contributor Author

nightroman commented Oct 1, 2024

Pinning to 1.3.0 seems to be working

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/graphql-voyager@1.3.0/dist/voyager.css" />
  <script src="https://cdn.jsdelivr.net/npm/graphql-voyager@1.3.0/dist/voyager.min.js"></script>

@nightroman
Copy link
Contributor Author

Submitted the PR with the version pinned to 1.3.0. It seems to be the last version working, later versions have issues.
Not sure I can suggest anything better, I am not an expert in Voyager or JavaScript as such.

@Inok
Copy link

Inok commented Oct 1, 2024

A workaround to force Voyager 1.3 on the latest GraphQL.Server.Ui.Voyager version:

app.UseGraphQLVoyager(options: new VoyagerOptions
{
    PostConfigure = (_, html) =>
        html.Replace(
            "https://cdn.jsdelivr.net/npm/graphql-voyager/",
            "https://cdn.jsdelivr.net/npm/graphql-voyager@1.3/"
        )
});

@Shane32
Copy link
Member

Shane32 commented Oct 2, 2024

Fixed in 8.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants