TriplyDB / Yasgui

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

Yasgui replaces Vue navigation route hash parameters #167

Open kinow opened 4 years ago

kinow commented 4 years ago

Hi,

I'm updating Apache Jena to use Vue.js, and decided to also update its Yasqe/Yasr version. My first try was to quickly create a <div id='yasgui'></div> and just create an Yasgui object.

However, I found that the Yasgui object replaces the URL route navigation when using hashes for navigation in Vue.js.

image

Every time I create the Yasgui object, I think it adds a tab. Adding the tab, it also calls the method to create the share link. That method is altering the URL hashes, which can be annoying to users.

For now I will try to use Yasqe + Yasr instead. But Yasgui had great features, and was very convenient. So changing that behaviour to leave the window hash intact would be great, if possible.

image

Thank you Bruno

kinow commented 4 years ago

Once the application is loaded, if I click on the link to the current page, then the URL is updated correctly (since the Share Link was already created).

gatperdut commented 3 years ago

is there any other way to circumvent this? I'm trying to use Yasgui on an angular application with ui-router and it's giving me grief, since it redirects me to the home page.

danielbeeke commented 1 year ago

I fixed it by:

// Save current hash
const hash = location.hash
location.hash = ''

// Init the yasgui and let it do hash things..
const element = document.createElement('div')
document.appendChild(element)
const yasgui = new Yasgui(element)

// Restore hash
location.hash = hash
kinow commented 1 year ago

That's clever @danielbeeke , going to give it a try when I have some spare time. Thanks!

kinow commented 1 year ago

That worked @danielbeeke . Thanks a lot again.

kinow commented 1 year ago

Nearly there. One thing that's bothering me now is that it appears to keep using #id123 for the tabs.

After you render the UI, take a look at the links for when you click on the tabs, and you should see it.

image

I believe that because of that, depending on your scroll bar location in the page, when you click on the tab the browser will load the new tab but also move you back to the top. I think somewhere it interprets that as a link (at least on Firefox) and wants to go to the top. But somewhere in YASGUI is must be intercepting that event and handling it correctly (since the tab works).

https://github.com/apache/jena/issues/1334