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

Memoize extra agent configurations. #3068

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

flvndvd
Copy link
Contributor

@flvndvd flvndvd commented Jan 4, 2024

This PR addresses the recently introduced regression (#3016) that resulted in multiple re-renders, which cleared the content from the input bar. The issue stemmed from alterations to the values returned by a hook that retains changes.

The issue comes from those lines:

const agentConfigurationsToAdd = additionalAgentConfigurations
? additionalAgentConfigurations.filter(
(a) => !baseAgentConfigurations.find((b) => a.sId === b.sId)
)
: [];
const agentConfigurations = [
...baseAgentConfigurations,
...agentConfigurationsToAdd,
];

Before:

editor-cleared

After:

editor-does-not-clear

@flvndvd flvndvd requested a review from fontanierh January 4, 2024 15:43
@flvndvd flvndvd self-assigned this Jan 4, 2024
@flvndvd flvndvd marked this pull request as ready for review January 4, 2024 15:43
@flvndvd flvndvd merged commit 4c98bb9 into main Jan 4, 2024
2 checks passed
@flvndvd flvndvd deleted the flav/memoize-extra-agent-configurations branch January 4, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants