ukrbublik/react-awesome-query-builder

generateConfig[fn] is not a function for antd package

Closed this issue · 4 comments

Describe the bug
The 'Uncaught TypeError: generateConfig2[fn] is not a function' error occurs when using the datetime widget from the antd package

To Reproduce

  1. Install the latest antd packages
  2. setup a query builder, with a field config of 'datetime'
  3. open the query builder and select the datetime field

Expected behavior
RangePicker widget to be shown

Screenshots
Screenshot 2024-03-04 at 16 37 44

Additional context
Likely to be caused by a mismatch of dependency 'rc-picker' and 'antd'. The 'antd' version specified in package.json uses the function getMillisecond and setMillisecond from 'rc-picker', which does not exist in the 'rc-picker' version specified in package.json. Overriding the 'rc-picker' version to latest solve the problem

I believe the fix that the OP refered to is adding this to the package.json file of your project:

  "overrides": {
    "@react-awesome-query-builder/antd": {
      "rc-picker": "^4.3.0"
    }
  },

Tested, and this fix the issue for me.

Note that when using an override one cannot use npm ci but must use npm i instead, which is annoying.
See npm/cli#4942

Thank you and yes, that's what I was referring to, should've included more details about the fix.

please publish latest version if this issue is fixed

Facing this same issue with datetime widget.
"@react-awesome-query-builder/antd": "^6.4.2",
"@react-awesome-query-builder/ui": "^6.4.2",
"react": "^18.2.0",

Applied above mentioned fix to override rc-picker version but it's giving another error mentioned below

/test/node_modules/react-scripts/scripts/start.js:19
throw err;
^

TypeError: fsevents.watch is not a function
at createFSEventsInstance (/test/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:94:25)
at setFSEventsListener (/test/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:150:16)
at FsEventsHandler._watchWithFsEvents (/test/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:353:18)
at FsEventsHandler.initWatch (/test/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:429:23)
at FsEventsHandler._addToFsEvents (/test/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:518:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.12.2