react-tabulator icon indicating copy to clipboard operation
react-tabulator copied to clipboard

Defaulting callbacks to NOOP breaks tabulator's assumptions (ajaxResponse)

Open c-dante opened this issue 5 years ago • 0 comments

Title

  • bug: Not setting ajaxResponse breaks ajax flow in Tabulator.

Environment Details

  • react-tabulator version: 0.12.7

Long Description https://github.com/ngduc/react-tabulator/blob/f84a92e5e6a8125e3dd1ddeb7b309c96cf6e6f16/src/ConfigUtils.tsx#L140-L154

The forced-NOOP default: output[callbackName] = props[callbackName] || NOOPS

Can pass invalid callback signatures into Tabulator.

Tabulator will detect this NOOPS as truthy, and run optional code. Some examples: https://github.com/olifolkerd/tabulator/blob/978b697dcdedd121e7f8510ae69dd4465ab8f6dc/src/js/modules/page.js#L562-L565

https://github.com/olifolkerd/tabulator/blob/978b697dcdedd121e7f8510ae69dd4465ab8f6dc/src/js/modules/ajax.js#L255-L257

Anywhere tabulator expects a callback to have a return type, this NOOP breaks the interface contract and fails.

Workaround Manually set unused callback methods to explicitly false

Patch Don't do this NOOP set on callbacks -- Tabulator handles defaults.

c-dante avatar Jun 19 '20 13:06 c-dante