stacks-archive / radiks

A client-side framework for building model-driven decentralized applications.
MIT License
96 stars 30 forks source link

ID without username causes exception #61

Open talhasch opened 4 years ago

talhasch commented 4 years ago

User.createWithCurrentUser() causes group-membership.js:190 Uncaught (in promise) TypeError: Cannot read property 'attrs' of undefined with non-username accounts.

Ekran Resmi 2019-11-23 15 25 06 Ekran Resmi 2019-11-23 15 27 15

Tested versions: 0.2.1, 0.3.0-beta.1

hdriqi commented 4 years ago

Yap also occurs on previous version and this is really important to fix, because user that are login using the recovery do not have their username in the first place

moxiegirl commented 4 years ago

@talhasch This type of error usually happens when the user is not signed in correctly, or the user is not available in radiks models, try to use User.createWithCurrentUser(); before the user start his session or logging in. Hank did an illustration of how to do this here: made the fix in the stackit sample which others can see here https://github.com/blockstack/stackit/pull/8

talhasch commented 4 years ago

@moxiegirl see https://github.com/blockstack/radiks/blob/master/src/models/group-membership.ts#L52

if the account doesn't have a username radiks creates _id field with an uuid and right after queries with the account's username (null) Since no match on server side that error occurs.

radiks highly rely on username but not all accounts have username.

i think identityAddress is more appropriate for _id field. It is unique and all accounts have it.

we have 1463 users on runkod so far but 303 of them (almost 1/4) couldn't login due to that problem. Even a TMUI tester couldn't login and runkod got very weak score.

moxiegirl commented 4 years ago

@talhasch Thanks for clarifying the issue. @jeffdomke I'm going to drop this back into the queue. The code does not handle the usecase where an id has no username. Need to decide if this is a feature request a bug. May also be something we need to simply have a better error for.