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

fix: pass noop as default value to unmountFn at connectors #3955

Merged
merged 1 commit into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/connectors/autocomplete/connectAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
checkRendering,
createDocumentationMessageGenerator,
find,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -41,7 +42,7 @@ const withUsage = createDocumentationMessageGenerator({
* @param {function} unmountFn Unmount function called when the widget is disposed.
* @return {function(CustomAutocompleteWidgetOptions)} Re-usable widget factory for a custom **Autocomplete** widget.
*/
export default function connectAutocomplete(renderFn, unmountFn) {
export default function connectAutocomplete(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/breadcrumb/connectBreadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
createDocumentationMessageGenerator,
isEqual,
find,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -44,7 +45,7 @@ const withUsage = createDocumentationMessageGenerator({
* @param {function} unmountFn Unmount function called when the widget is disposed.
* @return {function(CustomBreadcrumbWidgetOptions)} Re-usable widget factory for a custom **Breadcrumb** widget.
*/
export default function connectBreadcrumb(renderFn, unmountFn) {
export default function connectBreadcrumb(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());
return (widgetParams = {}) => {
const {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/clear-refinements/connectClearRefinements.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
clearRefinements,
getRefinements,
createDocumentationMessageGenerator,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -67,7 +68,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectClearRefinements(renderFn, unmountFn) {
export default function connectClearRefinements(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
getRefinements,
checkRendering,
createDocumentationMessageGenerator,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -100,7 +101,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectCurrentRefinements(renderFn, unmountFn) {
export default function connectCurrentRefinements(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/geo-search/connectGeoSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
const connectGeoSearch = (renderFn, unmountFn) => {
const connectGeoSearch = (renderFn, unmountFn = noop) => {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/hierarchical-menu/connectHierarchicalMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
createDocumentationMessageGenerator,
isEqual,
find,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -59,7 +60,7 @@ const withUsage = createDocumentationMessageGenerator({
* @param {function} unmountFn Unmount function called when the widget is disposed.
* @return {function(CustomHierarchicalMenuWidgetOptions)} Re-usable widget factory for a custom **HierarchicalMenu** widget.
*/
export default function connectHierarchicalMenu(renderFn, unmountFn) {
export default function connectHierarchicalMenu(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/hits-per-page/connectHitsPerPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
warning,
createDocumentationMessageGenerator,
find,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -94,7 +95,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectHitsPerPage(renderFn, unmountFn) {
export default function connectHitsPerPage(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/hits/connectHits.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
createDocumentationMessageGenerator,
addAbsolutePosition,
addQueryID,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -50,7 +51,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectHits(renderFn, unmountFn) {
export default function connectHits(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/menu/connectMenu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
checkRendering,
createDocumentationMessageGenerator,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -90,7 +91,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectMenu(renderFn, unmountFn) {
export default function connectMenu(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/numeric-menu/connectNumericMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
checkRendering,
createDocumentationMessageGenerator,
isFiniteNumber,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -97,7 +98,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectNumericMenu(renderFn, unmountFn) {
export default function connectNumericMenu(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/pagination/connectPagination.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
checkRendering,
createDocumentationMessageGenerator,
noop,
} from '../../lib/utils';
import Paginator from './Paginator';

Expand Down Expand Up @@ -84,7 +85,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectPagination(renderFn, unmountFn) {
export default function connectPagination(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/powered-by/connectPoweredBy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
checkRendering,
createDocumentationMessageGenerator,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -28,7 +29,7 @@ const withUsage = createDocumentationMessageGenerator({
* @param {function} unmountFn Unmount function called when the widget is disposed.
* @return {function} Re-usable widget factory for a custom **PoweredBy** widget.
*/
export default function connectPoweredBy(renderFn, unmountFn) {
export default function connectPoweredBy(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

const defaultUrl =
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/range/connectRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
createDocumentationMessageGenerator,
isFiniteNumber,
find,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator(
Expand Down Expand Up @@ -41,7 +42,7 @@ const withUsage = createDocumentationMessageGenerator(
* @param {function} unmountFn Unmount function called when the widget is disposed.
* @return {function(CustomRangeWidgetOptions)} Re-usable widget factory for a custom **Range** widget.
*/
export default function connectRange(renderFn, unmountFn) {
export default function connectRange(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/rating-menu/connectRatingMenu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
checkRendering,
createDocumentationMessageGenerator,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -92,7 +93,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectRatingMenu(renderFn, unmountFn) {
export default function connectRatingMenu(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/refinement-list/connectRefinementList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
checkRendering,
createDocumentationMessageGenerator,
isEqual,
noop,
} from '../../lib/utils';
import {
escapeFacets,
Expand Down Expand Up @@ -113,7 +114,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectRefinementList(renderFn, unmountFn) {
export default function connectRefinementList(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/search-box/connectSearchBox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
checkRendering,
createDocumentationMessageGenerator,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -63,7 +64,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectSearchBox(renderFn, unmountFn) {
export default function connectSearchBox(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/sort-by/connectSortBy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
createDocumentationMessageGenerator,
find,
warning,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -87,7 +88,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectSortBy(renderFn, unmountFn) {
export default function connectSortBy(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/stats/connectStats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
checkRendering,
createDocumentationMessageGenerator,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -46,7 +47,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectStats(renderFn, unmountFn) {
export default function connectStats(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => ({
Expand Down
3 changes: 2 additions & 1 deletion src/connectors/toggleRefinement/connectToggleRefinement.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
unescapeRefinement,
createDocumentationMessageGenerator,
find,
noop,
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
Expand Down Expand Up @@ -86,7 +87,7 @@ const withUsage = createDocumentationMessageGenerator({
* })
* );
*/
export default function connectToggleRefinement(renderFn, unmountFn) {
export default function connectToggleRefinement(renderFn, unmountFn = noop) {
checkRendering(renderFn, withUsage());

return (widgetParams = {}) => {
Expand Down