gmail.js icon indicating copy to clipboard operation
gmail.js copied to clipboard

'view_thread' and 'view_email' listeners are not fired on refresh in message view (after a while message view been kept open)

Open Nishanthi opened this issue 7 years ago • 9 comments

Hi

When I keep open the message view for couple of mins say 8-10, and then refresh the page I don't see the 'view_thread' and 'view_email' getting fired. In my extension, most of the use-cases and its functionality in message view is greatly dependent on these 2 events.

Anyone, any thoughts please.

Nishanthi avatar Feb 18 '18 14:02 Nishanthi

I though these events only triggered when they were originally rendered? I know at least some of these events are one time only.

Do they trigger repeatedly if you view a thread, go back to inbox and then re-view the thread without reloading?

josteink avatar Feb 19 '18 11:02 josteink

Yes, 'view_thread' is triggered repeatedly every time a thread is viewed, and going back to inbox and reviewing the thread without reload. And the sub-observer 'view_email' is triggered there after on all the emails when they get redendered (one time only)

These 2 events are triggered even on thread/message view reload, but on intermittent cases they fail to get triggered on reload after a while.

Nishanthi avatar Feb 19 '18 16:02 Nishanthi

I really have no idea what's going wrong here.

Can you reproduce this behaviour with a minimal extension (and if so, can you post the source in its own repo?)

If you leave the web-developer console window open while doing this... Do you see or encounter any errors there prior to this failing?

If you can answer yes to both of these questions, our chance of debugging this is slightly higher than zero :)

josteink avatar Feb 21 '18 06:02 josteink

I tried 'view_thread' with your 'gmailjs-node-boilerplate' repo, and this event gets triggered on every refresh in the thread view of an email.

But the same event fails intermittently in my working project without any errors on the console.

Nishanthi avatar Mar 18 '18 14:03 Nishanthi

In that case, it’s probably an issue with your project.

Do you use “traditional” script loading or bundling? The former has been known to cause unexplainable issues.

josteink avatar Mar 18 '18 20:03 josteink

@josteink

Is there a way this events can be triggered when the page is refreshed? If there is a way, the question is should this be done?

SanketDG avatar Nov 01 '19 10:11 SanketDG

@josteink @SanketDG @Nishanthi have you guys ever managed to resolved that? I am having the exactly the same issue as described above: the "thread_view" nor "email_view" (nor "delete" etc. for that matter) do fire if I refresh the page while being on the thread view.

When I navigate to list and back these are fired. Any ideas?

hubertlepicki avatar May 28 '20 12:05 hubertlepicki

@hubertlepicki Nope, this largely remains an issue with gmail.js

What I eventually did was find a unique identifier (an ID or class, I used td.gH.bAk, I cannot recall what exact element it pointed to), and after DOMContentLoaded is fired (basically $(document.ready), I check for the class and then just do whatever I need to do. In other words, it's just a naive implementation of view_email/view_thread.

SanketDG avatar May 28 '20 14:05 SanketDG

Sorry. but I haven't yet experienced this issue in a way which affects my production extension.

josteink avatar May 29 '20 05:05 josteink

Old issue is old. Closing.

josteink avatar Oct 11 '23 08:10 josteink