Skip to content

Commit aa3cd7b

Browse files
authored
refactor: handleMessage component (#1727)
Co-authored-by: Adi-204 <adiboghawala@gmail.com>
1 parent edf7b01 commit aa3cd7b

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

packages/components/src/components/HandleMessage.js

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,19 @@ else:
3232
*
3333
* @param {Object} props - Component props.
3434
* @param {Language} props.language - Programming language used for method formatting.
35-
* @param {string} props.methodName='handleMessage' - Name of the method to generate.
36-
* @param {string[]} props.methodParams=[] - List of parameters for the method.
37-
* @param {string} props.preExecutionCode - Code to insert before the main function logic.
38-
* @param {string} props.postExecutionCode - Code to insert after the main function logic.
35+
* @param {string} [props.methodName='handleMessage'] - Name of the method to generate.
36+
* @param {string[]} [props.methodParams=[]] - List of parameters for the method.
37+
* @param {string} [props.preExecutionCode] - Code to insert before the main function logic.
38+
* @param {string} [props.postExecutionCode] - Code to insert after the main function logic.
39+
* @param {Object} [props.customMethodConfig] - Optional overrides for default method configuration.
3940
* @returns {JSX.Element} Rendered method block with appropriate formatting.
4041
*/
41-
export function HandleMessage({ language, methodName = 'handleMessage', methodParams = [], preExecutionCode = '', postExecutionCode = '' }) {
42-
const {
43-
methodDocs = '',
44-
methodLogic = ''
45-
} = websocketHandleMessageConfig[language];
46-
42+
export function HandleMessage({ methodName = 'handleMessage', ...props }) {
4743
return (
4844
<MethodGenerator
49-
language={language}
45+
{...props}
46+
methodConfig={websocketHandleMessageConfig}
5047
methodName={methodName}
51-
methodParams={methodParams}
52-
methodDocs={methodDocs}
53-
methodLogic={methodLogic}
54-
preExecutionCode={preExecutionCode}
55-
postExecutionCode={postExecutionCode}
5648
indent={2}
5749
newLines={2}
5850
/>

0 commit comments

Comments
 (0)