TallerWebSolutions / apollo-cache-instorage

Apollo Cache implementation that facilitates locally storing resources
MIT License
96 stars 11 forks source link

Add a method to keep the cache in sync with local storage #10

Closed MartijnHols closed 4 years ago

MartijnHols commented 4 years ago

This adds a method to optionally add LocalStorage synchronization across tabs to an InStorageCache. It uses the storage event that is triggered in all tabs out of focus when a value is changed. This allows users to open an app in multiple tabs and see their changes immediately reflected across all tabs. Useful for methods such as add to cart.

I am not sure broadcastQueries is necessary anywhere other than when used with React, but I think it is safe to assume that it is likely still going to be useful.

codecov-io commented 4 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@61ace2f). Click here to learn what that means. The diff coverage is 28.57%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master     #10   +/-   ##
========================================
  Coverage          ?   84.3%           
========================================
  Files             ?       6           
  Lines             ?     172           
  Branches          ?      45           
========================================
  Hits              ?     145           
  Misses            ?      19           
  Partials          ?       8
Impacted Files Coverage Δ
src/keepCacheInSyncWithLocalStorage.js 0% <0%> (ø)
src/inStorageCache.js 100% <100%> (ø)
src/objectStorageCache.js 97.05% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 61ace2f...efc1ae6. Read the comment docs.