Sib Display missing resource after a login
With Sib App, after I logout then login I get a blank page like that:
Console say: TypeError: undefined has no properties storeMixin.js:22:11
- 9 times
Component resource is present on console and every property is there:
Refresh page makes everything appear correctly.
I usually never meet this problem on first login. I got the exact same problem on private browsing session.
Link issues together to show that they're related. Learn more.
Activity
- Maintainer
This line of sib-chat seems to be responsible for it: https://git.happy-dev.fr/startinblox/components/sib-chat/blob/master/sib-chat.js#L68
The context is probably not complete, it has only 3 entries. The resources are loaded with this context so they cannot find other
http://happy-dev.fr/owl/#something
predicates.In sib-chat, every time you do a
initGraph
, you should do this:await store.initGraph(this.resource['@id'], this.context);
this.context
will return the default context merged with theextra_context
. Then, if you define a "default" extra-context like this, it should work:get extra_context() { return { "foaf": 'http://xmlns.com/foaf/0.1/', "chatProfile": "http://happy-dev.fr/owl/#chatProfile", "jabberID": "foaf:jabberID" }; },
- Please register or sign in to reply
- Author Owner
I'm pretty sure we did this together. Anyway, I've fixed that, still facing the same problem.
- Maintainer
Yes with the changes we added to the cache of the store, it probably broke what we did together.
Are you sure it's not working, I cannot reproduce the error now
- Author Owner
I still face it, yes. Logout then login, some users on right menu miss their username, and I miss half of the datas on the page. :(
- Maintainer
Here: https://git.happy-dev.fr/startinblox/components/sib-chat/blob/master/sib-chat.js#L41
it should be
extra_context
, to add it the the default context. Otherwise, you override the default context with yours
- Author Owner
Updated, now I don't get missing datas on left menu, but I still have no name on top right user name after logout -> login.
- Maintainer
Ok so it must have another place where data is not loaded properly, I'll check
- Maintainer
This is also a context issue. In your app, to avoid problems with LDFlex, we added camelCase properties in contexts like
firstName
. Here,https://alpha/users/matthieu
is loaded without this extraContext. As this workaround is no longer useful, you can just removefirstName
from your extra-context and callfirst_name
everywhere
- Author Owner
I'll give that a try.
But I really don't get why it's only after a logout then a login. Whenever you refresh after that, it always works fine..?
- Maintainer
It seems that after a login, sib-chat is the first one to load the user. It does a
initGraph
with a context different that the one in your app.
- Benoit Alessandroni added P1 + 1 deleted label
added P1 + 1 deleted label
- Benoit Alessandroni changed milestone to %0.10
changed milestone to %0.10
- Maintainer
@jbpasquier : did you have time to try what @matthieu proposed and is this better ?
- Author Owner
Thanks for follow up, forgot this one while away.
Still the same (branch context-fix of sib-app)
- Maintainer
I cannot reproduce. I used the branch
context-fix
, data fromapi.alpha.happy-dev.fr
and Chrome. I logout and login (with and without clearing the cache), and I always have my username, circles and 1-1 chat displayed. Am I missing something? - Author Owner
Branch is actually merged and I still face it everywhere.
Edited by Jean-Baptiste Pasquier - Maintainer
Ok I'll have a look!
- Maintainer
Two things here:
- For the username, the user may be loaded with the wrong extra-context (missing
firstName
andlastName
). As it was just a workaround for LDFlex, I suggest to remove this. (I made it here) - For the circles, it only fails in incognito mode for me (not just after login). Here are the data I receive this from the server:
{ @id: "https://api.alpha.happy-dev.fr/users/matthieu/", ... circles: { @id: "https://api.alpha.happy-dev.fr/users/matthieu/circles/", @type: "ldp:Container", ldp:contains: [], permissions: [] } }
The
sib-display
tries to displayhttps://api.alpha.happy-dev.fr/users/matthieu/circles/
, so it does not find anything, as the response is empty here. In normal mode, there is data in the array and everything display properly - For the username, the user may be loaded with the wrong extra-context (missing
- Author Owner
After looking on your second track, I found that some of first requests after a login does not include the user credentials, they are made as an anonymous user.
- Maintainer
@matthieu @jbpasquier : status here ? Linked to 595 maybe then ?
We plan to delay the initialization of the store after the current user is initialized, if any. So that we are sure the user credentials are passed.
- Author Owner
Sounds related for me, but no confirmation on this.
If so, your plans seems to fix it. :)
- Maintainer
@balessan So what's the plan, waiting for #595 (closed)?
- Author Owner
@balessan @matthieu @clement As #595 (closed) is now closed, what's the status on this one please?
- Maintainer
Do you still have the bug?
- Author Owner
Yes, still the same, first requests after a login are made as an anonymous user.
- Maintainer
@clement do you think it is a
sib-core
orsib-auth
issue? -
You have to use sib-core beta https://unpkg.com/@startinblox/core@beta
-
Be sure sib-core is loaded before other dependencies: sib-auth, sib-chat and others will load sib-core master.
-
- Author Owner
@clement Do you mean that we should use the beta version on our production instance or that we can test it with beta if we want and it'll be released soon?
- Maintainer
@jbpasquier Did you have time to test with the beta? Do you still have the bug?
- Author Owner
Didn't had time, sorry.
Anyway from exchanges with @clement it sounds that it's unrelated to #595 (closed).
- Maintainer
@clement : reminder, if you could give us an overview of where you are at on this one ?
What are your clues/ideas ?
Yes, it seems to be related to this issue: sib-auth#33 (closed)
Edited by Clément
- Jean-Baptiste Pasquier mentioned in issue djangoldp-packages/djangoldp-account#43 (closed)
mentioned in issue djangoldp-packages/djangoldp-account#43 (closed)
- Rachel mentioned in issue management/sip-app-management#1
mentioned in issue management/sip-app-management#1