Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Fixing problem with fake forceUpdate not updating with latest React v…
Browse files Browse the repository at this point in the history
…ersions
  • Loading branch information
Helene Rigner committed Feb 20, 2019
1 parent f76d0a1 commit 913b478
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/cube.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export default function Cube({ app, tableData: { initialColumns }, closeOnClickO
}
addOpen.current = false;
columnToReplace.current = null;
forceUpdate();
forceUpdate(Date.now());
}

function openAdd() {
currentHeader.current.classList.add('active');
addOpen.current = true;
forceUpdate();
forceUpdate(Date.now());
}

function toggleAdd(e) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/cubes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function Cubes({ app, closeOnClickOutside }) {
]);
}
addOpen.current = false;
forceUpdate();
forceUpdate(Date.now());
}

function removeCube(id) {
Expand All @@ -39,7 +39,7 @@ export function Cubes({ app, closeOnClickOutside }) {

function openColumnChooser() {
addOpen.current = true;
forceUpdate();
forceUpdate(Date.now());
}

const popup = addOpen.current ? <CubeColumnChooser arrowStyle="arrowRight" alignTo={addButtonRef.current} selectableColumns={selectableColumns} chooseColumn={column => addCube(column)} closeOnClickOutside={closeOnClickOutside} /> : null;
Expand Down
4 changes: 3 additions & 1 deletion src/components/hypercube-table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ export default function HypercubeTable({
const hypercubeProps = createProperties(dimensions, measures);
const model = useModel(app, hypercubeProps);
const layout = useLayout(model);

if (!model) {
return null;
}
const calculatedWidth = getTotalTableWidth(layout, dimensions, measures);
if (layout && calculatedWidth > 0) {
return (
Expand Down

0 comments on commit 913b478

Please sign in to comment.