Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messes with back/forward history navigation #27

Open
Boscop opened this issue Oct 11, 2017 · 14 comments
Open

Messes with back/forward history navigation #27

Boscop opened this issue Oct 11, 2017 · 14 comments

Comments

@Boscop
Copy link

Boscop commented Oct 11, 2017

When I'm on GitHub in a source file (history index n) and go back in chrome (n-1), sometimes only the URL bar changes to the previous (n-1) URL but the content stays the same (n), when this extension is installed.
Then I have to reload or go back (n-2) and forward (to n-1) to get to that page (n-1).
This shouldn't happen, please fix it :)

@fiatjaf
Copy link
Owner

fiatjaf commented Oct 11, 2017

Does that happen even if you don't interact with Module Linker at all (by clicking on links it generates)?

@AlexWayfer
Copy link

Does that happen even if you don't interact with Module Linker at all (by clicking on links it generates)?

Yes. I have the same issue sometimes.

@Boscop
Copy link
Author

Boscop commented Oct 11, 2017

Yes, when not clicking the module links.

@fiatjaf
Copy link
Owner

fiatjaf commented Oct 19, 2017

I can't reproduce that, but it is probably being caused by jquery-pjax.

How frequent are these issues? Is it somewhat related to GitHub loading times? When it happens, does GitHub show that blue bar on the top, as if it was loading the page (when you press the back button)?

If there are errors on the console, can you paste them here?

@AlexWayfer
Copy link

I can't reproduce that

  1. Open this directory
  2. Open application.rb file
  3. Click on browser Back button
  4. Click on browser Forward button
  5. Repeat 3 and 4 with different pauses
  6. If nothing — reload page with directory (1) and try again.

Is it somewhat related to GitHub loading times?

It's related to module-linker re-initialization, I guess.

When it happens, does GitHub show that blue bar on the top, as if it was loading the page (when you press the back button)?

No.

If there are errors on the console, can you paste them here?

No errors.

@fiatjaf
Copy link
Owner

fiatjaf commented Oct 19, 2017

I've tried it multiple times, alternating pauses, reloading and trying again and again and again. Got nothing. I'm on Firefox, however.

@AlexWayfer
Copy link

I'm on Firefox, however.

Oh. I'm on Chrome 😅

Okay, let's try…

Yeah, I repeated this on the second computer, and on Firefox. With the second or the third attempt, I think.

Look at URL → Page content.

image

@fiatjaf
Copy link
Owner

fiatjaf commented Oct 20, 2017

I use Chrome sometimes, on other computers with Module Linker installed, and don't remember seeing that error there too. 😅

Anyway, ok, let me say this: when I said I couldn't reproduce I wasn't doubting you or that the bug existed, I just meant I couldn't see the bug on my computer, so I couldn't debug it or fix it. I was saying basically that I needed help debugging and fixing it.

@AlexWayfer
Copy link

AlexWayfer commented Oct 20, 2017

@fiatjaf OK, thank you.

Now it's stable for me:

Open flame/lib/flame dir (link above), click application.rb, wait for module-linker initialization (these dots near files), press Back, wait 1–2 seconds, press Forward, you'll see module-linker dots again, and they will disappear, wait, they'll appear again, press Back — BOOM, page content isn't changing, but URL is.


Also, you can try to give me some version of extension with debugging output (to console), I think, because now console is really empty.

@fiatjaf
Copy link
Owner

fiatjaf commented Oct 20, 2017

Oops, there isn't any of that. If you're really into it you might want to download the source code from GitHub, spread out some console.log() and debugger statements, run npm run watch to build, then load it as an unpackaged extension.

But it is ok if you don't want that work. I'll try to find this error again later.

@AlexWayfer
Copy link

If you're really into it you might want to download the source code from GitHub, spread out some console.log() and debugger statements, run npm run watch to build, then load it as an unpackaged extension.

I offered to make a debug version you, because you know better where in the code there are critical places and which state is better to track.

But it is ok if you don't want that work. I'll try to find this error again later.

And I don't have much free time and skills with JS + npm + Chrome extensions :(

@fiatjaf
Copy link
Owner

fiatjaf commented Nov 25, 2017

I was able to reproduce.

It's probably related to jquery.pjax, as it is used by GitHub itself, but also by Module Linker (so we can have the same navigation features of GitHub). The way I glued it into the code was somewhat hacky, because it doesn't seem to do what I was expecting it to do (probably my misunderstanding), so I bet the answer lies there.

I need some help here, please.

@AlexWayfer
Copy link

AlexWayfer commented Nov 25, 2017

I need some help here, please.

Does main function can affect to GitHub scripts? I think it's Chrome-extension function and the answer is "no".

Will this bug reproducing without return? Or with always-enabled return? Just clarify: we're needing to complicate the condition or to replace it with another.

@fiatjaf
Copy link
Owner

fiatjaf commented Nov 25, 2017

The return is there to guarantee we don't run the initialization function twice. But why would this initialization change the URL of the page?

Maybe what's happening is that when we press Back for some reason jquery.pjax fails to load the previous page, but does change the URL. Perhaps the first step to debug it would be to listen for their events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants