OneGraph / graphiql-explorer

Explorer plugin for GraphiQL
MIT License
907 stars 97 forks source link

Would be nice if I have a prop `loading` #56

Open soorajshankar opened 4 years ago

soorajshankar commented 4 years ago

currently, it shows no schema found until we load the schema, and no way to show a loading mask. (now only we can wrap this with a loading component)

omavi commented 4 years ago

+1 , I'm willing to open a PR for this feature if it'll be seriously considered for merge.

sgrove commented 4 years ago

What would be the advantage over controlling loading from the outside?

Off the top of my head, I suppose it's one fewer thing the developer has to configure.

But ultimately the different is that when first loading the application, a user will see "no schema found" for a bit, whereas with the proposed prop, they would see "Loading..." ?

omavi commented 4 years ago

controlling loading from outside

Is there a way to accomplish this without updating this codebase? And yes, it'd be nice to pass a function component to render whatever we want. It could be simple text such as Loading..., a spinner animation, or whatever.

omavi commented 4 years ago

@sgrove, I see what you're saying now. Instead of loading the explorer, just render our own loading component until the schema load is finished. In that case, yes, this would just be one less thing that has to be configured and styled.

soorajshankar commented 4 years ago

Yeah, currently we also do the same by wrapping another component which shows the loading spinner.