You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, shout out to an amazing project! I have been able to be very productive using your libraries, the typings and documentations are great, the API is generous. Thank you.
Some background information: I am working on an in-house plugin that aim to provide the ability to save operations in a personal collection and persist them in a DB. You can also switch between different teams and collaborate on collections of queries on team level.
So when you write a query in the query editor and click "Add" button it gets saved to your current teams collection. Then I want to keep tabs in sync with currently selected operation. This provides the concept of "current operation".
Now, if you start changing an operation, it will be marked as dirty in the side bar and the "save icon" switches color and shows that needs to be saved.
There are some edge cases though. But let's keep it simple and only ask one question!
No ability to stop a tab from closing
If you close tab with dirty state I have no possibility to stop that from happening. There is no API to provide something to GraphiQL that can invoke a method before closing a tab. For example, I would love to have provide an onCloseTab: ({ index, closeTab }) to GraphiQL or directly as an option to useEditorContext. If this method is provided, the user has to manually invoke the close callback to actually close the tab, but can also opt not to do so and instead display a dialog. If not provided, the default implementation is basically just onCloseTab={({ closeTab }) => { closeTab() }}
That way I can pop up a Dialog confirming that the user really want to close without saving their changes, and if they confirm I can invoke closeTab(index) myself and if they cancel the tab stays open.
The way it works today it just gets closed and I would have to reopen a new tab with the unsaved stuff and then prompt the user which would be terrible.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
First of all, shout out to an amazing project! I have been able to be very productive using your libraries, the typings and documentations are great, the API is generous. Thank you.
Some background information: I am working on an in-house plugin that aim to provide the ability to save operations in a personal collection and persist them in a DB. You can also switch between different teams and collaborate on collections of queries on team level.
So when you write a query in the query editor and click "Add" button it gets saved to your current teams collection. Then I want to keep tabs in sync with currently selected operation. This provides the concept of "current operation".
Example:
https://user-images.githubusercontent.com/2785359/220887613-42d7e953-d502-453c-9dc8-eed8d623e157.mov
Now, if you start changing an operation, it will be marked as dirty in the side bar and the "save icon" switches color and shows that needs to be saved.
Example:
https://user-images.githubusercontent.com/2785359/220888722-3e0a74a5-6047-4ac4-afd5-6bdf351ef242.mov
There are some edge cases though. But let's keep it simple and only ask one question!
No ability to stop a tab from closing
If you close tab with dirty state I have no possibility to stop that from happening. There is no API to provide something to GraphiQL that can invoke a method before closing a tab. For example, I would love to have provide an
onCloseTab: ({ index, closeTab })
toGraphiQL
or directly as an option touseEditorContext
. If this method is provided, the user has to manually invoke theclose
callback to actually close the tab, but can also opt not to do so and instead display a dialog. If not provided, the default implementation is basically justonCloseTab={({ closeTab }) => { closeTab() }}
That way I can pop up a Dialog confirming that the user really want to close without saving their changes, and if they confirm I can invoke
closeTab(index)
myself and if they cancel the tab stays open.The way it works today it just gets closed and I would have to reopen a new tab with the unsaved stuff and then prompt the user which would be terrible.
Beta Was this translation helpful? Give feedback.
All reactions