Skip to content

Conversation

andreaskienle
Copy link
Contributor

@andreaskienle andreaskienle commented Oct 10, 2025

This PR resolves a race condition triggered during MCP page re-renders, for example, when opening the YAML splitter from the MCP header.

The reason was that useApiResource used the SWR key ⁠[resource.path, apiConfig] while fetching the same MCP resource with different configs (depending on excludeMcpConfig being true/false). Because both responses shared the same SWR key, the full response occasionally overwrote the smaller one in the cache. This lead to issues when expected fields were missing.

I now added excludeMcpConfig to the SWR cache key, so we have separate entries in the cache.

@Copilot Copilot AI review requested due to automatic review settings October 10, 2025 08:29
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a race condition in the API resource hook by adding excludeMcpConfig to the SWR key dependencies.

  • Added excludeMcpConfig parameter to the SWR cache key to ensure proper cache invalidation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@andreaskienle andreaskienle marked this pull request as draft October 10, 2025 08:31
@andreaskienle andreaskienle marked this pull request as ready for review October 10, 2025 10:13
Copy link
Contributor

@Hubert-Szczepanski-SAP Hubert-Szczepanski-SAP left a comment

Choose a reason for hiding this comment

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

I checked this locally and issue is fixed :)

@andreaskienle andreaskienle merged commit a045950 into main Oct 10, 2025
5 checks passed
@andreaskienle andreaskienle deleted the fix/fetch-race-condition branch October 10, 2025 11:01
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