Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fix issue with React StrictMode causing Dataset table to not display #2683

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ritesh9876
Copy link

Describe the bug
When clicking the "View Data Table" button in a React or Next.js application while using Strict Mode, the dataset table is not visible. This issue occurs because this.setState is set to an empty function in the componentDidUnmount lifecycle method.

In Strict Mode, componentDidUnmount is called at the start (detect potential issues), which causes this.setState to be set as an empty function prematurely. As a result, any subsequent calls to setState do not change the state of the component.

The issue has been fixed by introducing a hasMounted flag to ensure that setState is only called when the component is mounted.

A similar issue occurs when the data table is visible, and the three vertical dots near each column are clicked. In Strict Mode, the dropdown menu does not appear.

To Reproduce
Steps to reproduce the behavior:

  1. Go to examples/demo-app/src/main.js or create a new React/Next.js application.
  2. Wrap the component in React.StrictMode.
  3. Open the application in the browser, upload a dataset, and click the "View Data Table" button.
  4. Observe that the dataset table is blank.

Expected behavior
The dataset table should be visible, and the dropdown near each column name should be functional in Strict Mode.

Desktop (please complete the following information):

  • OS: Ubuntu
  • Browser: Chrome, firefox
  • Version: Ubuntu 24.04.1 LTS

kepler_dataset_issue

Copy link

netlify bot commented Oct 10, 2024

Deploy Preview for keplergl2 ready!

Name Link
🔨 Latest commit adde7ab
🔍 Latest deploy log https://app.netlify.com/sites/keplergl2/deploys/67082a95332ce20008079e76
😎 Deploy Preview https://deploy-preview-2683--keplergl2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant