Firebase seems to save names based on local devices

47 views Asked by At

First of all, not sure where to post this on the Stack community.

I am creating an app, which suppose to be responsive, see: pedecabra.ideacodinglab.com When I save to Firebase, from different devices, it creates the same collection twice, it supposes not to happen. But...just warned the user to use the same device. But now, when I try to erase from the computer, I cannot erase from a computer what was created on my device: Android 11, Galaxy A3.

This an example, there are two Jorge Guerra Pires, which supposes not to happen, two collections with same name. When I try to erase, it does not recognize the name. I have done copy&paste from the other collection, where it recognized.

enter image description here

My theory: Firebase saves name based on local information, from the device. For us humans, it is transformed into strings, but the compute compares strings based on local operation system

I have done a research on Google, using searching sentences such as "same strings on different operation systems are different".

Discussion

"they are no longer existing just ont the device(s). " it saved locally the name, and also on the database. You can access from the same device, even after closing the app. But just the app can access the collection it created.

" It sounds like there is a difference between the names, like for example some whitespace or non-printable characters. "

tried manually, enter the caracter. Even the automatic access, from the app, just get what it created, even though they exist

See the several duplicates, which should not exist. I wanted the same nickname be accessable from several devices.

enter image description here

Same problem, typed manually, and tried copy&paste enter image description here

1

There are 1 answers

0
Jorge Guerra Pires On

The problem was that somewhere, no idea where, a small space was introduced in the end: it was just introduced in one device, I have already fixed, no idea which one.

So: Collection #1: Jorge Guerra Pires/ Collection #2: Jorge Guerra Pires /

They were different. I have to give a small space to erase.

On the code:

this.store.collection(this.username.replace(/\s+/g, '')).add({ "timestamp": this.timestamp, "sentimentos": aux });

I have added in the end of username, before without: replace(/\s+/g, '')

Thus, I just had to make sure wherever the space was coming from, it would be eliminated before creating or accessing the Firebase collection.

Tried several space, to make sure

Now I can access the same collection from different devices!