tiagofernandez / mui-querybuilder Goto Github PK
View Code? Open in Web Editor NEWQuery builder for React applications based on Material UI v4.
License: MIT License
Query builder for React applications based on Material UI v4.
License: MIT License
when a state object is passed in as filters props, then the state object is updated, the querybuilder component does not update to reflect the new filters props.
In dynamic options example, http://tiagofernandez.com/mui-querybuilder/iframe.html?id=muiquerybuilder--supported-types&viewMode=docs#dynamic-options, the Button that updates filters state is
<Button
color="primary"
disabled={loaded}
variant="outlined"
onClick={() => {
const updatedFilters = [...filters];
[
{ label: "January", value: 1 },
{ label: "February", value: 2 },
{ label: "March", value: 3 },
{ label: "April", value: 4 },
{ label: "May", value: 5 },
{ label: "June", value: 6 },
{ label: "July", value: 7 },
{ label: "August", value: 8 },
{ label: "September", value: 9 },
{ label: "October", value: 10 },
{ label: "November", value: 11 },
{ label: "December", value: 12 },
].forEach(month => {
updatedFilters[0].options[0].options.push(month);
});
setFilters(updatedFilters);
setLoaded(true);
}}
>
the problem with this example is the const updatedFilters = [...filters]; is making a shallow clone of the filters state so when the forEach function makes modifications to the inner object it is mutating the state. This is making the changes appear in the filters object. The setFilters(updatedFilters); does not make a difference.
To test this remove the setFilters(updatedFilters); line and it will still work.
Hi, facing an issue on below
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
Refer: https://codesandbox.io/s/musing-nobel-rfdqt?file=/src/App.js
need your help with solve this issue
If I use the QueryBuilder with redux for query/setQuery instead of useState, the following error is thrown:
Uncaught TypeError: Cannot add property id, object is not extensible
Resulting in the page crashing.
The problem occurs here with this code:
mui-querybuilder/src/QueryBuilder.jsx
Lines 187 to 205 in f7dc0d9
react: 17.0.2
mui-querybuilder: 1.2.1
Hello! I faced with next issue:
https://reactjs.org/warnings/invalid-hook-call-warning.html
Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
In my project used react 17.0.2
"react": "^17.0.1",
"react-dom": "^17.0.1",
Do I need update react version for mui-builder too? Or this is can be other issue?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.