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

onChange has undefined event #2994

Open
RobinShift4 opened this issue Jan 26, 2024 · 5 comments
Open

onChange has undefined event #2994

RobinShift4 opened this issue Jan 26, 2024 · 5 comments

Comments

@RobinShift4
Copy link

RobinShift4 commented Jan 26, 2024

Within this code

`{dashboardFilters?.map((filter) => {

          return (

            <DashFilters 

              filter={filter || {}}

              expression={filterValues[filter.name] || filter.default_value}

              onChange={(event) => handleFilterChange(event, filter.name)}

              key={filter.id}

              token={currentDashboard.token}

            />

          );

        })}`

my event is always undefined (and thus I cannot use the value of the component in the function). Any idea as to why?

@mdodgelooker
Copy link
Contributor

Hi @RobinShift4 DashFilters is not one of our components. Would you be able to provide a repro on codesandbox or similar or provide the code for your DashFilters component?

@mdodgelooker
Copy link
Contributor

mdodgelooker commented Jan 29, 2024

Hi @RobinShift4 it could have something to do with how React state is being used. I've created a simpler example using our DashboardFilter component from the @looker/filter-components package. It's an easier-to-use option than DashFilters from the example you used above. Let me know if it's helpful: https://codesandbox.io/p/sandbox/jovial-gould-forked-rzh8y5

Docs for DashboardFilter component: https://looker-open-source.github.io/components/latest/?path=/docs/filters-docs-dashboardfilter--docs

@RobinShift4
Copy link
Author

@mdodgelooker thanks - I was able to get that to work though I am not sure what was going wrong earlier.

@mdodgelooker
Copy link
Contributor

@RobinShift4 that's great!

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

No branches or pull requests

2 participants