question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blinking/Uncatching Behaviour

See original GitHub issue

I’m using this repository with a react application with react router, and what I’ve found is that it has a problem regarding blinking before things actually start loading; that makes sense because it’s the time that it takes the request to be performed to the update the state.

Also if I have no connection during an operation it will just, never work; it will not even seek for old data in that was already used.

I have a proposal, I could make a PR for it in which I’d use mozilla’s localForage library to store objects, being in, IndexedDB, WebSQL or even localStorage; and use them to populate the element rather than firebase itself.

Eg. in browsers that support IndexedDB the flow will be Firebase -> IndexedDB -> ReactFire

If for some reason it’s disconnected Firebase -/-> IndexedDB -> ReactFire

IndexedDB will keep serving ReactFire, and will avoid blinking if resources have not changed as it’ll be pretty fast accesible, the app will keep working even without internet unless a resource that has not been catched is asked for, load times of pages will be basically none and it’ll sync first with the local and then with the remote. In very old browsers that don’t even have localStorage, then it’ll work as normal.

Precaching previous using a resource will be also possible, and of course, deleting resources from the local. eg.

ReactFire.catch(myRef)
ReactFire.delete(myRef)

//or

ReactFire.catch('/documents/-123124dkfasd')
ReactFire.delete('/documents/-123124dkfasd')

In the case of browsers with no support this function will do absolutely nothing.

once in a component I do.

this.bindAsObject(myRef,'value')

I’ll get, in fact; the value stored in my IndexedDB, WebSQL; database, rather than directly from firebase, and any update done by firebase inside those storages will cause my element to update, in fact, it’ll be totally backwards compatible.

Without support of those storages it’ll work just as designed now.

There are several considerations with this, and it’s that the product will be somewhat bigger and it’ll have dependencies.

Also for some reason I can’t get how your source code is structured, it seems like it’s already processed by browserfy or the like; is there any original source code?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
alexwilsoncommented, Jun 11, 2016

I could see that working really well, and best of all would be framework agnostic. This kind of client-side caching seems almost like an absolute necessity when pulling information to build the state of an app, when the network can be slow or unavailable.

0reactions
jwngrcommented, Jun 15, 2016

Hey there, thanks for the discussion so far. I agree that this seems like more of a thing that belongs in the core Firebase SDK, not ReactFire. Unfortunately, the core Firebase SDK is not yet open sourced, so for now, you’d have to build a wrapper around the SDK which has this behavior. Note that we have longterm plans to bring true offline persistence to the JavaScript SDK like we have with the mobile SDKs, but it is still a good deal off.

Marking as “invalid” just because this isn’t the right place to introduce this kind of behavior. I definitely would love to see you make something like this, but I think it should live independent of ReactFire.

Let me know if you’ve got questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

There's more to blinking than meets the eye
According to an unusual and innovative recent study, blinking is a visual clue that influences our everyday conversations.
Read more >
Humans quickly learn to blink strategically in response ... - PNAS
Subjects were able to learn environmental regularities and adapted their blinking behavior strategically to better detect future events.
Read more >
How do you spot a lie? It's all to do with the 'blinking' obvious
The psychologists say that the discovery, reported in the Journal of Non-verbal Behaviour, means that blink rates could be used by professionals ......
Read more >
Blinks: A Phenomenon of Distractibility in Attention Deficit ...
A blink occurs as the ADDers attention involuntarily shifts focus from what is relevant to something irrelevant. This shift from a 'local" situation...
Read more >
The Blink Flurry: Deception, emotion and cognition
This intriguing eye behaviour has been described under several names; it's been called an eyelid flutter, blink burst, flicker, flickering, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found