TriplyDB / Yasgui

Yet Another Sparql GUI
https://yasgui.triply.cc
MIT License
178 stars 54 forks source link

Send a tabid along with query in POST request #209

Open eric-personal opened 1 year ago

eric-personal commented 1 year ago

Hi I'm trying to add an id to the post request. Currently the payload is query: ..... I also want to add and {id:value} along with the query. I'm using React and saving an instance of yasgui in a ref.

I've tried to do it in 2 places of my code to add the id before the POST happens.

The first approach does not work at all.

yasgui.current.on("query", onHandleQueryStart);

  const onHandleQueryStart = (instance, tab) => {
      instance.config.requestConfig.args = [
        {
          name: "id",
          value: getSelectedTabId(),
        },
      ];
  },

The second approach kind of works except its ignoring the first tab when added. Then all added tabs after that it adds the last id to the newly added tab.

  const onTabAdded = (tab, tabId) => {
      tab.config.requestConfig.args = [
        {
          name: "id",
          value: tabId,
        },
      ];
    }

Is there a correct way to add a tabId to the Post request before it gets submitted ?