From 070002acf522fab86b7d1b3c0b8ee40733c3bb52 Mon Sep 17 00:00:00 2001 From: Aroooba Date: Sun, 29 Jan 2023 11:31:34 +0900 Subject: [PATCH] Clear tableTypes collection when TablePage unmounts to avoid memory leak --- src/pages/TablePage.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/TablePage.js b/src/pages/TablePage.js index 45373a1a7..49d6d42e2 100644 --- a/src/pages/TablePage.js +++ b/src/pages/TablePage.js @@ -1,10 +1,18 @@ import Page from 'components/Page'; -import React from 'react'; +import React, { useEffect } from 'react'; import { Card, CardBody, CardHeader, Col, Row, Table } from 'reactstrap'; const tableTypes = ['', 'bordered', 'striped', 'hover']; const TablePage = () => { + useEffect(() => { + return () => { + if (tableTypes && tableTypes.length) { + tableTypes.splice(0, tableTypes.length); + } + }; + }, []); + return (