Single page application architecture and router based state.

Discussion of current events and participation in intelligent conversation with other CEF users.

Single page application architecture and router based state.

Postby irf » Mon Nov 23, 2015 9:16 am

Hi,
I am using a Single page JsApp architecture with CEF via

- React
- React router

However i am not using html push state since in my case i am loading the html/js codebase via a file:/// url. So my urls essentially look like file://baseurl#/path1/argument1/argument2 etc.
Essentially the client side router is using the "#/path1" in absence of push state. The problem that i am facing is that when an application logic switches the url from one url to another the CEF is triggering a load and reloading the page.

I was not expecting this since url changes from file://baseurl#/path1/etc/ to file://baseurl#/path2/etc/. Since only the part after # is changing, this should be treated as a local anchor tag and should not cause a page load. Is this an expected behaviour or is this a bug in CEF. Any suggestions to deal with this issue would be welcome.

I am using Ubuntu 64Bit
CEF branch 2454

Thanks
irf
Newbie
 
Posts: 5
Joined: Mon Nov 23, 2015 9:01 am

Re: Single page application architecture and router based st

Postby magreenblatt » Mon Nov 23, 2015 10:28 am

How does it behave in Google Chrome?
magreenblatt
Site Admin
 
Posts: 8036
Joined: Fri May 29, 2009 6:57 pm

Re: Single page application architecture and router based st

Postby irf » Mon Nov 23, 2015 10:29 am

Chrome does not reload the page.
irf
Newbie
 
Posts: 5
Joined: Mon Nov 23, 2015 9:01 am

Re: Single page application architecture and router based st

Postby magreenblatt » Mon Nov 23, 2015 12:06 pm

Can you provide a working example of the problem?
magreenblatt
Site Admin
 
Posts: 8036
Joined: Fri May 29, 2009 6:57 pm

Re: Single page application architecture and router based st

Postby irf » Tue Nov 24, 2015 12:32 am

this is easily reproduced by loading "https://en.wikipedia.org/wiki/Multiple_inheritance" in cefclient test app
and clicking on different page headers (These are local "anchors" eg: https://en.wikipedia.org/wiki/Multiple_ ... e#See_also)

we are getting below callbacks on cefloadHandler

CefLoadHandler:: OnLoadingStateChange.--> isLoading: 1

CefLoadHandler:: OnLoadStart.

CefLoadHandler:: OnLoadingStateChange.--> isLoading: 0
irf
Newbie
 
Posts: 5
Joined: Mon Nov 23, 2015 9:01 am

Re: Single page application architecture and router based st

Postby magreenblatt » Tue Nov 24, 2015 11:37 am

The calls to OnLoadingStateChange are expected. Chromium's WebContentsDelegate::LoadingStateChanged method has an additional |to_different_document| argument that would be useful to expose in this case. Feel free to add an issue for exposing that argument.
magreenblatt
Site Admin
 
Posts: 8036
Joined: Fri May 29, 2009 6:57 pm

Re: Single page application architecture and router based st

Postby irf » Wed Nov 25, 2015 8:38 am

Thanks for your reply.
I dont see a corresponding invocation CefLoadHandler ::OnLoadEnd for these. Is this expected as well?
irf
Newbie
 
Posts: 5
Joined: Mon Nov 23, 2015 9:01 am

Re: Single page application architecture and router based st

Postby magreenblatt » Wed Nov 25, 2015 12:41 pm

irf wrote:Thanks for your reply.
I dont see a corresponding invocation CefLoadHandler ::OnLoadEnd for these. Is this expected as well?

Yes. This was fixed in http://crbug.com/539952#c2 (currently master branch only).
magreenblatt
Site Admin
 
Posts: 8036
Joined: Fri May 29, 2009 6:57 pm

Re: Single page application architecture and router based st

Postby irf » Tue Dec 01, 2015 11:28 pm

magreenblatt, I see that sure this period of time if there is a callback from javascript, it seems to not get executed. js context is not getting reset etc. It still functions after load. But during this time the callbacks seem to not do anything.
irf
Newbie
 
Posts: 5
Joined: Mon Nov 23, 2015 9:01 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

Fatal: Not able to open ./cache/data_global.php