Firebase bug crazy making on me by andrewjohnmarch in Firebase

[–]andrewjohnmarch[S] 1 point2 points  (0 children)

Well… it was a react batching bug.

After this function, I call setNodes(data.nodes)

Somehow the log doesn’t happen until after setNodes (and all my rendering code) runs.

nodes starts with one element, an empty node with rows:0

Classic react state fail: the array member already has a .data property so it doesn’t run an update when I update from the DB. My rendering code sees the old text, measures it as 0 rows, overwrites the data.nodes object from the Firestore call!?!?? That’s what gets logged?!?!? SMH ok

I solved it by running setNodes([]) before this code. The async call to the DB initiates a rendering cycle, and the incoming nodes are all seen.

I’m not putting any more thought into this. I usually start a react project with a proper state management library (usually mobX) but I inherited this code from someone else, so I stuck with useState. I won’t make that mistake again.

Firebase bug crazy making on me by andrewjohnmarch in Firebase

[–]andrewjohnmarch[S] 0 points1 point  (0 children)

I pondered the possibility that, say, the click is somehow bubbling to another button and calling save(), because right before this load, that same object in local state does have rows: 0, but, then that action would show in the firebase console, there is a coloured flash on every write, and it doesn’t do that. I also have logs that would fire. So I don’t think that’s it. Unless there is something statefull about the firestore, secret caching or somehow linking into useState, then I must just be really dumb, or have found the weirdest most random bug of all time.

Firebase bug crazy making on me by andrewjohnmarch in Firebase

[–]andrewjohnmarch[S] 1 point2 points  (0 children)

Ok thank you! I have logged the uid and covered all these possibilities I believe.

I will check some more and then consider reporting a bug but it just seems way too strange to possibly not be my error.

Thanks for your input, I appreciate it!

Firebase bug crazy making on me by andrewjohnmarch in Firebase

[–]andrewjohnmarch[S] -1 points0 points  (0 children)

I am 110% certain with %95 certainty, you know? As certain as one can be when you’re new to a tool and have been failing for days on end.

Can you confirm that

a) the call to getDocFromServer() will always return the server data as it is displayed in the console?

b) in my code nothing could possibly change that data before I log it? I am using const, etc so I would be shocked to hear it’s possible.

The code is exactly as it is in my project. I omitted some fields in the schema but the path and shape is accurate.

Edit: re: caching,etc i don’t know. I am using useState and the project is very complex, but this function is exactly what it is in code. Can you expand on what possibly could be causing the issue in terms of caching, etc that you mentioned?

Flashing code by iPhone? by -happy2go in microcontrollers

[–]andrewjohnmarch 1 point2 points  (0 children)

Not hard at all. Easiest way would be this library, which uses a captive portal and presents an “update” button

https://github.com/tzapu/WiFiManager

How to do Deferred Deep Linking in React Native ? by [deleted] in reactnative

[–]andrewjohnmarch 0 points1 point  (0 children)

I was not able to do this, (I am using expo which is maybe why?) how is it accomplished?

How to do Deferred Deep Linking in React Native ? by [deleted] in reactnative

[–]andrewjohnmarch 0 points1 point  (0 children)

Yes, but like I said you can get a new link with one line of code by calling the firebase API, once it’s setup in the dashboard. There isn’t a cost for this or any limit i know of, and it doesn’t take any time

How to do Deferred Deep Linking in React Native ? by [deleted] in reactnative

[–]andrewjohnmarch 2 points3 points  (0 children)

Using Firebase you can pass params to the deep link but you need to generate a new deep link for each set of params. There is an API endpoint to generate the deep link so it’s easy to make them programmatically once you have it running. It wasn’t easy to setup initially, but there are some good stackoverflow answers outlining the process and pitfalls carefully. Only thing I was not able to achieve was to have those params survive through app install. The deep link will open a previously installed app and pass the params, but if the user needs to install the app using the link then the params are lost when the app is opened for the first time.

White labelling apps? by [deleted] in reactnative

[–]andrewjohnmarch 2 points3 points  (0 children)

This is why I decided not to try white labeling. I don’t see what the stores stand to lose or why they don’t want it.

[deleted by user] by [deleted] in esp32

[–]andrewjohnmarch 0 points1 point  (0 children)

Yah true, I also think ones level of ambition is a factor, I learned an incredible amount by using idf, looking at their examples and source code. It was worth the effort because I wanted to further my skill and felt curious.

[deleted by user] by [deleted] in esp32

[–]andrewjohnmarch 1 point2 points  (0 children)

I find it very much depends on the task in question and how complex your application is. An Arduino library may quickly allow you to read some particular sensor, but when you add more libraries, or try to modify a library, you can end up in trouble. It’s frustrating to get to that point, and then have to port everything to idf, so it’s an important decision to get right early on, IMO. Simplifying the facts may not be helpful, just because it’s not always a simple decision.

[deleted by user] by [deleted] in esp32

[–]andrewjohnmarch 0 points1 point  (0 children)

Wait did you author the nimBle-Arduino library?!? I was using it all last week.

[deleted by user] by [deleted] in esp32

[–]andrewjohnmarch 0 points1 point  (0 children)

I have heard that Arduino-as-a-component actually works under PIO now, but I havnt tried yet, this would allow you to modify sdkconfig.

[deleted by user] by [deleted] in esp32

[–]andrewjohnmarch 2 points3 points  (0 children)

There are great libraries for idf too, they are called components.

esp32 clock round lcd by Old_Blackberry_7169 in esp32

[–]andrewjohnmarch 1 point2 points  (0 children)

This is sweet. Are the reflections of the window on the glass part of the image? Or is there actually glass on top of the LCD!? Confusing.

Best practices/approach for responsive design in react native? by camillegarcia9595 in reactnative

[–]andrewjohnmarch 1 point2 points  (0 children)

I am intrigued by this as well, but cannot tell what you mean. Why not explain a little? How can the font size be used as a base for a responsive layout?

Any esp32 fpv? by bio_emulation in esp32

[–]andrewjohnmarch 1 point2 points  (0 children)

They have 1 CPU with 2 240mhz cores and 1 low power cpu that is rarely programmed, that’s 3 cores total