adding logic to load a cached version when offline