GithubHelp home page GithubHelp logo

studentofjs / query-plus Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 298 KB

fetch and process data in web worker, store in indexedDB.

License: MIT License

TypeScript 100.00%
idb idb-keyval indexeddb react web-worker web-worker-react

query-plus's Issues

useFetch tests

Add tests for useFetch hook. react-hook-testing library or maybe just react-testing-library. Unsure on mocking indexedDB and a web worker, possibly a step too far

Improve FetchWithIntent component

Ideas for improvements:

Use coordinates instead of mouse enter /mouse leave. This will allow for a larger area and we could do it by data attr instead of having to use a component.

  • Use coordinates plus/minus x amount as the countdown zone
  • Ensure there is only one countdown running at a time
  • Convert setTimeout to promise

component to prefetch on intent

Create a component that:

  • - takes the same props as usePreFetch + children + a time to execute
  • - on mouseenter or focus starts timer
  • - on mouseleave or blur stops timer
  • - initiates prefetch when the timer exceeds time to execute
  • - manages timers carefully

allow requests to be marked as don't call unless expired

We are currently calling the api, regardless, to get the data to diff it against what is saved. If the endpoint always returns the same data, or updates on a semi regular basis (i.e. monthly) then it would be desirable to set the maxAge and not call the api if it hasn't expired. However, we will need a way to differentiate between this and endpoints where it would be desireable to check the api for new data on every call.
There appears to be two obvious solutions:

  1. add a variable to the request
  2. create a seperate function for fetching data, that only calls the api if none exists

I feel the first option is easier to use, but more prone to mistakes.

tech spike Cache api review

  • limited to 50MB in Safari
  • clears after 2 weeks in Safari
  • issues on iphone???

Are there any performance benefits to using this as a first layer of cache, before the space runs out?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.