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

Fixing forceUpdate not working in latest versions of React #188

Merged
merged 2 commits into from
Feb 21, 2019

Conversation

hrigner
Copy link

@hrigner hrigner commented Feb 20, 2019

Closing #187

@hrigner hrigner requested a review from peol February 20, 2019 12:43
@netlify
Copy link

netlify bot commented Feb 20, 2019

Deploy preview for catwalk-qlikcore ready!

Built with commit 992501a

https://deploy-preview-188--catwalk-qlikcore.netlify.com

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want a "loading" thingie here instead of null?

@@ -39,7 +39,7 @@ export function Cubes({ app, closeOnClickOutside }) {

function openColumnChooser() {
addOpen.current = true;
forceUpdate();
forceUpdate(Date.now());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nicer with a const forceUpdate = useForce(); hook, that did the Date.now() magic behind the scenes, so you'd still just do forceUpdate(). That way we can keep the logic in one place and change it easily in the future if needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a useForce hook using a bool instead of Date.now().

Copy link
Contributor

@peol peol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@hrigner hrigner merged commit 1d04bef into master Feb 21, 2019
@hrigner hrigner deleted the hypercube-two-columns branch February 21, 2019 06:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants