Repository: graphql/graphql-playground

Issue #892: It's not possible to Save to File
Created: 2018-11-26T10:33:24Z
This issue pertains to the following package(s):

 GraphQL Playground

What OS and OS version are you experiencing the issue(s) on?
Ubuntu LTS 18.04 (also not working on macOS 10.14.1)
What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?
1.8.2. (also not working on 1.8.3.)
What is the expected behaviour?
It should be possible to save to file.
What is the actual behaviour?
It's not possible to save to file.
What steps may we take to reproduce the behaviour?
Create a request and try to save it to file. After clicking Save to File nothing happens.
Please provide a gif or image of the issue for a quicker response/fix.
Not much to add, just try to save and nothing will happen.

Duplicate issue #749: Cannot save workspace: path must be a string or Buffer
Created: 2018-06-25T10:03:31Z
This issue pertains to the following package(s):

 GraphQL Playground - Electron App

What OS and OS version are you experiencing the issue(s) on?
Windows 10 x64
What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?
1.6.0
What is the expected behavior?
Being able to save workspace so I can reopen it next time instead of entering endpoint URL every time. I would assume that if I create .graphqlconfig file by hand and use that, it would probably work, but generally, I don't have any other use for that file so I don't it floating in a project folder.
What is the actual behavior?
Clicking on Workspace -> Save seemingly does nothing. Opening developer console I can see the output.
handleSaveConfig called
calling this.props.onSaveConfig undefined
Uncaught (in promise) TypeError: path must be a string or Buffer
    at Object.fs.openSync (fs.js:646:18)
    at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:172:20)
    at Object.fs.writeFileSync (fs.js:1303:33)
    at Object.App._this.saveConfig [as onSaveConfig]

Might be some NodeJS incompatibility? I am currently running v10.4.1.
What steps may we take to reproduce the behavior?

Open the app
Select "Endpoint URL" as a new workspace
Enter correct URL
After opening workspace, try to click Workspace -> Save

Closing comment (2019-08-17T10:47:48Z): If you do not open a workspace from a file, you won't be able to save it. There is no functionality "Save Workspace As" now.
This is related to #892, but not exactly the same, because this issue is about the workspace configuration file and that one about the graphql query file.
If you trigger saving and the current tab was not opened from a file, the workspace configuration will be saved instead. The error on the console is caused by a bug in saveConfig. Instead of checking if the workspace was opened from a file and either showing an error or choosing a name, it just uses the undefined configPath value to call writeFileSync. Obviously, the writeFileSync retaliates:
// v1.8.10/packages/graphql-playground-electron/src/renderer/components/App.tsx, line 490
fs.writeFileSync(_this.state.configPath, configString);
The code should be more robust in supporting the scenario that you start the playground with an endpoint only, not by opening a workspace file. "Save As" for a workspace would be nice. There is a feature request for it: #727.