Created
          October 25, 2021 21:39 
        
      - 
      
- 
        Save jasonbahl/c619fc9e3f128940178eb4c51697bc3c to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * This is an example showing how to add a custom action | |
| * to the operation action menu | |
| */ | |
| hooks.addFilter( | |
| "graphiql_operation_action_menu_items", | |
| "graphiql-extension", | |
| (menuItems, props) => { | |
| const { Menu } = props; | |
| console.log({ | |
| graphiql_operation_action_menu_items: { | |
| menuItems, | |
| props, | |
| }, | |
| }); | |
| // Return the menuItems, with our new item added | |
| return { | |
| ...menuItems, | |
| test: ( | |
| <Menu.Item | |
| onClick={({ domEvent }) => { | |
| domEvent.preventDefault(); | |
| domEvent.stopPropagation(); | |
| alert(`clicked the new menu item!`); | |
| console.log({ | |
| filteredOperationActionMenuItem: { | |
| menuItems, | |
| props, | |
| }, | |
| }); | |
| }} | |
| > | |
| Filtered Item! | |
| </Menu.Item> | |
| ), | |
| }; | |
| } | |
| ); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment