Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-clear-cache

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-clear-cache - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

4

dist/index.d.ts

@@ -11,6 +11,6 @@ import * as React from 'react';

} & typeof defaultProps;
export declare const useClearCache: (props: OwnProps) => {
export declare const useClearCache: (props?: OwnProps | undefined) => {
loading: boolean;
isLatestVersion: boolean;
emptyCacheStorage: (version: string) => Promise<void>;
emptyCacheStorage: (version?: string | undefined) => Promise<void>;
latestVersion: string;

@@ -17,0 +17,0 @@ };

@@ -125,29 +125,34 @@ import { useRef, useEffect, useState } from 'react';

function fetchMeta() {
fetch(baseUrl, {
cache: 'no-store'
})
.then(function (response) { return response.json(); })
.then(function (meta) {
var newVersion = meta.version;
var currentVersion = appVersion;
var isUpdated = newVersion === currentVersion;
if (!isUpdated && !auto) {
console.log('An update is available!');
setLatestVersion(newVersion);
setLoading(false);
if (appVersion) {
setIsLatestVersion(false);
try {
fetch(baseUrl, {
cache: 'no-store'
})
.then(function (response) { return response.json(); })
.then(function (meta) {
var newVersion = meta.version;
var currentVersion = appVersion;
var isUpdated = newVersion === currentVersion;
if (!isUpdated && !auto) {
console.log('An update is available!');
setLatestVersion(newVersion);
setLoading(false);
if (appVersion) {
setIsLatestVersion(false);
}
else {
setVersion(newVersion);
}
}
else if (!isUpdated && auto) {
emptyCacheStorage(newVersion);
}
else {
setVersion(newVersion);
setIsLatestVersion(true);
setLoading(false);
}
}
else if (!isUpdated && auto) {
emptyCacheStorage(newVersion);
}
else {
setIsLatestVersion(true);
setLoading(false);
}
});
});
}
catch (err) {
console.error(err);
}
}

@@ -154,0 +159,0 @@ useEffect(function () {

@@ -129,29 +129,34 @@ 'use strict';

function fetchMeta() {
fetch(baseUrl, {
cache: 'no-store'
})
.then(function (response) { return response.json(); })
.then(function (meta) {
var newVersion = meta.version;
var currentVersion = appVersion;
var isUpdated = newVersion === currentVersion;
if (!isUpdated && !auto) {
console.log('An update is available!');
setLatestVersion(newVersion);
setLoading(false);
if (appVersion) {
setIsLatestVersion(false);
try {
fetch(baseUrl, {
cache: 'no-store'
})
.then(function (response) { return response.json(); })
.then(function (meta) {
var newVersion = meta.version;
var currentVersion = appVersion;
var isUpdated = newVersion === currentVersion;
if (!isUpdated && !auto) {
console.log('An update is available!');
setLatestVersion(newVersion);
setLoading(false);
if (appVersion) {
setIsLatestVersion(false);
}
else {
setVersion(newVersion);
}
}
else if (!isUpdated && auto) {
emptyCacheStorage(newVersion);
}
else {
setVersion(newVersion);
setIsLatestVersion(true);
setLoading(false);
}
}
else if (!isUpdated && auto) {
emptyCacheStorage(newVersion);
}
else {
setIsLatestVersion(true);
setLoading(false);
}
});
});
}
catch (err) {
console.error(err);
}
}

@@ -158,0 +163,0 @@ React.useEffect(function () {

{
"name": "react-clear-cache",
"version": "1.2.0",
"version": "1.2.1",
"description": "A component to manage application updates.",

@@ -5,0 +5,0 @@ "author": "noahjohn9259",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc