From 0b5a150e78c867b17cc6ef569d907a354e560e54 Mon Sep 17 00:00:00 2001 From: ducwings Date: Fri, 10 Apr 2020 08:57:15 -0700 Subject: [PATCH] chore: add undefined check --- CHANGELOG.md | 2 +- ISSUE_TEMPLATE.md | 16 +++++++--------- lib/Utils.js | 9 +++++++-- package.json | 2 +- src/Utils.tsx | 9 +++++++-- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd1c857..251d710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## [0.12.0] - 2020-04-09 +## [0.12.1] - 2020-04-09 ### Changed - BREAKING: removed date-fns dependency. DateEditor now uses taylorhakes/fecha code: Date format string changed to 'MM/DD/YYYY'. diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 1ce0924..c951f9e 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,19 +1,17 @@ **Title** -- bug: XYZ broken... -- feature: please add... -- enhancement: add this to existing features... - -**Short Description:** -- Unable to get a result from blah... + - bug: XYZ broken... + - feature: please add... + - enhancement: add this to existing features... **Environment Details** + * react-tabulator version: * OS: * Node.js version: **Long Description** -- (and screenshot) + - please add screenshot(s) + - please add a Codesandbox link -**Code** ```JS JS code example goes here... (a Codesandbox link is preferred) ``` @@ -22,4 +20,4 @@ JS code example goes here... (a Codesandbox link is preferred) ... -Please help with a PR if you have a solution. Thanks! +(Please help with a PR if you have a solution. Thanks!) diff --git a/lib/Utils.js b/lib/Utils.js index caa4fb2..202d66d 100644 --- a/lib/Utils.js +++ b/lib/Utils.js @@ -26,8 +26,13 @@ function reactFormatter(JSX) { //onRendered - function to call when the formatter has been rendered var renderFn = function () { var cellEl = cell.getElement(); - var CompWithMoreProps = React.cloneElement(JSX, { cell: cell }); - react_dom_1.render(CompWithMoreProps, cellEl.querySelector('.formatterCell')); + if (cellEl) { + var formatterCell = cellEl.querySelector('.formatterCell'); + if (formatterCell) { + var CompWithMoreProps = React.cloneElement(JSX, { cell: cell }); + react_dom_1.render(CompWithMoreProps, cellEl.querySelector('.formatterCell')); + } + } }; onRendered(renderFn); // initial render only. setTimeout(function () { diff --git a/package.json b/package.json index 0c3f012..e0e192f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-tabulator", - "version": "0.12.0", + "version": "0.12.1", "description": "React Tabulator is based on tabulator - a JS table library with many advanced features.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/Utils.tsx b/src/Utils.tsx index a25d338..cf58cb9 100644 --- a/src/Utils.tsx +++ b/src/Utils.tsx @@ -26,8 +26,13 @@ export function reactFormatter(JSX: any) { const renderFn = () => { const cellEl = cell.getElement(); - const CompWithMoreProps = React.cloneElement(JSX, { cell }); - render(CompWithMoreProps, cellEl.querySelector('.formatterCell')); + if (cellEl) { + const formatterCell = cellEl.querySelector('.formatterCell') + if (formatterCell) { + const CompWithMoreProps = React.cloneElement(JSX, { cell }); + render(CompWithMoreProps, cellEl.querySelector('.formatterCell')); + } + } } onRendered(renderFn); // initial render only.