Skip to content

Commit

Permalink
chore: add undefined check
Browse files Browse the repository at this point in the history
  • Loading branch information
ngduc committed Apr 10, 2020
1 parent 2dda838 commit 0b5a150
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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'.
Expand Down
16 changes: 7 additions & 9 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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)
```
Expand All @@ -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!)
9 changes: 7 additions & 2 deletions lib/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 7 additions & 2 deletions src/Utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0b5a150

Please sign in to comment.