B4J Question [ABMaterial] 4.0 problem with stability

MichalK73

Well-Known Member
Licensed User
Longtime User
Hello.

I went through one project with 3.75 n 4.0 and something is wrong. At 3.75 all pages load completely, 4.0 at random, sometimes (not always) does not load me part of the components. At the moment I do not have NavigatorBar, I have a clean box but zero menu items. Same with the content of the page.
Some elements are always up and some are random. You need to refresh the page to load.
Projects are identical in terms of code, differing in libraries from a given version. Do not know if I only have it? Could this be a new version of the cache? So far I have to leave on server 3.75 because it is more stable in my project.
 

alwaysbusy

Expert
Licensed User
Longtime User
We have never experienced such thing in all our tests and I have converted a lot of apps to the new system.

1. Have you opened it in Chrome, pressed F12 and looked at the network and console tab for errors? (You can post a screenshot of the console/network tab if you want me to take a look)
2. Have you ran your app once in debug mode (to generate a new .needs file) and copied that new one to your server?
3. What happens if you press CTRL+F5 (no cache, all freshly loaded from the server)?
4. Have you copied the complete css/js/font folder from the library folder to your server?
 
Upvote 0

MichalK73

Well-Known Member
Licensed User
Longtime User
No visible NaviBar
ad.1 error1.png error2.png
error3.png Hidden element?? Move to www.adres.com not www.adres.com/projekt
 
Last edited:
Upvote 0

MichalK73

Well-Known Member
Licensed User
Longtime User
Still in the free time will once again convert the app from 3.75 to 4.00 because as I wrote in another post I had a problem. Maybe some kind of smell was left and spoiled it all.

add. This gray box in NaviBar appears when the mouse is hovering over this field. And so NaviBar is displayed blank as there is no cursor there.
 
Upvote 0

MichalK73

Well-Known Member
Licensed User
Longtime User
I remodeled one line and the app works fine and fast. There are no errors. The question now is whether this code is so important.
B4X:
Public Sub NavigateToPage(ws As WebSocket, PageId As String, TargetUrl As String) 'ignore
    '----------------------MODIFICATION-------------------------------
    Dim testTargetUrl As String = TargetUrl
    If Not(testTargetUrl.EndsWith(".htm") Or testTargetUrl.EndsWith(".html") Or testTargetUrl.EndsWith("/")) Then
        TargetUrl = TargetUrl & "/"
    End If

    If PageId.Length > 0 Then ABM.RemoveMeFromCache(CachedPages, PageId)
    If ws.Open Then
        ' it doesn't keep navigation history in the browser (the back button exists the application)
        'ws.Eval("window.location.replace(arguments[0])", Array As Object(TargetUrl))
        ' if you need browser history just comment the lines above and uncomment the lines below
        ' it keeps the navigation history in the browser
        ws.Eval("window.location = arguments[0]", Array As Object(TargetUrl))
        ws.Flush
        'ws.Close <----- DELETE
    End If
    '----------------------MODIFICATION-------------------------------
End Sub
 
Upvote 0

mindful

Active Member
Licensed User
@MichalK73 with ws.Close not commented out do you encounter your error?

Because that line of code does nothing else than closing the socket (which your browser will do eventually when it changes location). In my code I placed it the as a 'security' measure, because if you connect to the websocket with something else than a browser, the client will not understand the js script that the server is sending and will not close the connection...

Something like:
B4X:
If session.IsNew Then
  session.Invalidate
  ABMShared.NavigateTo(.....) ' whitout that code the ws connection will remain open if the client isn't a browser
End If

Anyway if that cause your problems then you can leave it out (it doesn't cause any problems for me)...
 
Upvote 0
Top