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

Defines the last 4 parameters of the asyncConnect function with optional #5986

Merged
merged 3 commits into from
Apr 29, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/volto/news/5985.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Defines the last 4 parameters of the `asyncConnect` function with optional. @wesleybl
10 changes: 10 additions & 0 deletions packages/volto/src/helpers/AsyncConnect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ const applyExtenders = (asyncItems, pathname) => {
* with the "object promises" and that's our "object promises" (which it calls
* internally "asyncItems").
*/
/**
* Higher-order function that enhances a React component with asynchronous data fetching and Redux integration.
*
* @param {Array} asyncItems - An array of async items to fetch.
* @param {Function} [mapStateToProps] - A function that maps the Redux state to component props.
* @param {Function} [mapDispatchToProps] - A function that maps Redux dispatch to component props.
* @param {Function} [mergeProps] - A function that merges the props from mapStateToProps, mapDispatchToProps, and the component's own props.
* @param {Object} [options] - Additional options for configuring the async connect behavior.
* @returns {Function} - A function that takes a React component and returns an enhanced component with async connect functionality.
*/
export function asyncConnect(
asyncItems,
mapStateToProps,
Expand Down
12 changes: 11 additions & 1 deletion packages/volto/types/helpers/AsyncConnect/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
* with the "object promises" and that's our "object promises" (which it calls
* internally "asyncItems").
*/
export function asyncConnect(asyncItems: any, mapStateToProps: any, mapDispatchToProps: any, mergeProps: any, options: any): (Component: any) => any;
/**
* Higher-order function that enhances a React component with asynchronous data fetching and Redux integration.
*
* @param {Array} asyncItems - An array of async items to fetch.
* @param {Function} [mapStateToProps] - A function that maps the Redux state to component props.
* @param {Function} [mapDispatchToProps] - A function that maps Redux dispatch to component props.
* @param {Function} [mergeProps] - A function that merges the props from mapStateToProps, mapDispatchToProps, and the component's own props.
* @param {Object} [options] - Additional options for configuring the async connect behavior.
* @returns {Function} - A function that takes a React component and returns an enhanced component with async connect functionality.
*/
export function asyncConnect(asyncItems: any[], mapStateToProps?: Function, mapDispatchToProps?: Function, mergeProps?: Function, options?: any): Function;
export const ReduxAsyncConnect: any;
export { loadOnServer, loadAsyncConnect } from "./ssr";