Skip to content

Conversation

sanjaikumar-bruno
Copy link
Contributor

No description provided.

@sanish-bruno
Copy link
Collaborator

@sanjaikumar-bruno add jira also brief description, screen-recording of the issue

@@ -8,11 +8,23 @@ const BulkEditor = ({ params, onChange, onToggle, onSave, onRun }) => {
const preferences = useSelector((state) => state.app.preferences);
const { displayedTheme } = useTheme();

const parsedParams = useMemo(() => serializeBulkKeyValue(params), [params]);
const itemsText = useMemo(() => serializeBulkKeyValue(params), [params]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanjaikumar-bruno i distinctly remember we introduced parsedParams useMemo inorder to avoid two sources of truth and the inconsistencies that get introduced with it. I remember the usage useState was causing inconsistencies within the editor behaviour, This change may cause a regression in editor behaviour. will you be able to test the behaviour throughly?

// Editor local state
const [editorText, setEditorText] = useState(itemsText);

useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are changing a state that is also a dependency of the useEffect, which will cause infinite loops and can crash the application. This might not be ideal. @sanjaikumar-bruno

We introduced useMemo to avoid this behaviour. earlier!

@@ -22,7 +34,7 @@ const BulkEditor = ({ params, onChange, onToggle, onSave, onRun }) => {
mode="text/plain"
theme={displayedTheme}
font={preferences.codeFont || 'default'}
value={parsedParams}
value={editorText}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe, we will haven't found root cause of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants