diff --git a/example/src/components/Layout/Layout.jsx b/example/src/components/Layout/Layout.jsx index 5306d38..b83de87 100644 --- a/example/src/components/Layout/Layout.jsx +++ b/example/src/components/Layout/Layout.jsx @@ -43,15 +43,13 @@ const Layout = () => ( Demo - - { - routes.map(({ title, to }) => { - return ( - - {title} - - ) - }) + + { + routes.map(({ title, to }) => ( + + {title} + + )) } diff --git a/package-lock.json b/package-lock.json index 3119c5a..d799cf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "@babel/register": "^7.17.7", "@cypress/code-coverage": "^3.9.12", "@cypress/webpack-preprocessor": "^5.15.7", - "@edsc/eslint-config": "^0.0.5", + "@edsc/eslint-config": "^0.0.6", "@testing-library/dom": "^8.19.0", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", @@ -2092,10 +2092,11 @@ } }, "node_modules/@edsc/eslint-config": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/@edsc/eslint-config/-/eslint-config-0.0.5.tgz", - "integrity": "sha512-2vIcOp8bJamWJv/INpEGCpgmzRsGGJ/xVE/ke0FVBbrmbt5OUUhw2CfVx+NBrvopzegP/f37C1XU2I2owvCjfg==", + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@edsc/eslint-config/-/eslint-config-0.0.6.tgz", + "integrity": "sha512-SaJa1hdpOhgQL1Sem08VxjOL5HWSRkf1jInNa5i4Rt1icepWVl4rvk/pomOhlzUWT+XuRKsnSvxHC/nfSnN8Ug==", "dev": true, + "license": "Apache-2.0", "peerDependencies": { "@babel/eslint-parser": "^7.22.7", "eslint": "^8.44.0", @@ -22543,9 +22544,9 @@ "dev": true }, "@edsc/eslint-config": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/@edsc/eslint-config/-/eslint-config-0.0.5.tgz", - "integrity": "sha512-2vIcOp8bJamWJv/INpEGCpgmzRsGGJ/xVE/ke0FVBbrmbt5OUUhw2CfVx+NBrvopzegP/f37C1XU2I2owvCjfg==", + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@edsc/eslint-config/-/eslint-config-0.0.6.tgz", + "integrity": "sha512-SaJa1hdpOhgQL1Sem08VxjOL5HWSRkf1jInNa5i4Rt1icepWVl4rvk/pomOhlzUWT+XuRKsnSvxHC/nfSnN8Ug==", "dev": true, "requires": {} }, diff --git a/package.json b/package.json index 92f5e0a..43059a1 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@babel/register": "^7.17.7", "@cypress/code-coverage": "^3.9.12", "@cypress/webpack-preprocessor": "^5.15.7", - "@edsc/eslint-config": "^0.0.5", + "@edsc/eslint-config": "^0.0.6", "@testing-library/dom": "^8.19.0", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", diff --git a/src/index.jsx b/src/index.jsx index 0080b6e..21a2d05 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -225,20 +225,17 @@ export const EDSCTimeline = ({ * Calculates the new intervals list width */ const calculateNewIntervalListWidth = () => { - if (timelineWrapperRef.current) { - // Anytime new time intervals are calculated update the pixel width of their container - const duration = getIntervalsDuration(timeIntervals, zoomLevel) + const duration = getIntervalsDuration(timeIntervals, zoomLevel) - const newTimelineWrapperWidth = timelineWrapperRef.current.getBoundingClientRect().width + const newTimelineWrapperWidth = timelineWrapperRef.current.getBoundingClientRect().width - const width = determineScaledWidth( - duration, - zoomLevel, - newTimelineWrapperWidth - ) + const width = determineScaledWidth( + duration, + zoomLevel, + newTimelineWrapperWidth + ) - return width - } + return width } // On page load, set the interval list width