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

export-data

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

export-data - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

17

lib/cjs/components/FileDownloadLink.js

@@ -27,3 +27,2 @@ "use strict";

const react_1 = __importStar(require("react"));
const react_dom_1 = require("react-dom");
const utils_1 = require("../utils");

@@ -35,14 +34,16 @@ const FileDownloadLink = ({ fileType, encoding = "utf-8", filename = "data", columnNames, rows, onClick, setsDataAsyncInOnClick, children, }) => {

(0, react_1.useEffect)(() => {
setDownloadUrl((0, utils_1.createDownloadUrl)((0, utils_1.dataToString)(columnNames, rows, fileType), fileType, encoding));
}, [columnNames, rows, fileType, encoding]);
(0, react_1.useEffect)(() => {
var _a;
const data = (0, utils_1.dataToString)(columnNames, rows, fileType);
if (downloadOnDataChange) {
(0, react_dom_1.flushSync)(() => setDownloadUrl((0, utils_1.createDownloadUrl)(data, fileType, encoding)));
(_a = downloadLink.current) === null || _a === void 0 ? void 0 : _a.click();
setDownloadOnDataChange(false);
(_a = downloadLink.current) === null || _a === void 0 ? void 0 : _a.click();
}
else {
setDownloadUrl((0, utils_1.createDownloadUrl)(data, fileType, encoding));
}, [downloadUrl]);
const handleClick = (e) => {
/* The data url is already set, so this click is only to trigger the download */
if (downloadOnDataChange) {
return;
}
}, [columnNames, rows, fileType, encoding]);
const handleClick = (e) => {
if (onClick) {

@@ -49,0 +50,0 @@ onClick(e);

{
"name": "export-data",
"version": "0.0.2",
"version": "0.0.3",
"description": "Export data in React to CSV and other file formats",

@@ -5,0 +5,0 @@ "types": "./lib/cjs/types/index.d.ts",

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