Fix for login with firebase

According to the docs there is a breaking issue with login for thunkable. And it really is breaking, if you try to login and the fields are empty, the entire app will crash and lose state. The issue is two fold. First, text input that hasn’t been initialized is considered undefined, not null, not 0 just undefined. This causes a problem to saving in local storage, as saving a key with a value for undefined isn’t supported. Then, during the signup, sending an undefined string results in an error message. To get around this I made a simple fix that finds the length of the undefined string, gets the 0, checks it for both the password and email fields and then proceeds. Photo attached, I’d suggest updating the docs to reflect this so the app doesn’t keep crashing.

1 Like

I also did this trick in my apps. Gud to see someone found same solution.

1 Like

I did this cause the space is counted as a character and they could still send an empty string, but you pointed the bug so I understand it’s not needed for this purpose