Skip to content

Conversation

@finnar-bin
Copy link
Contributor

Ensures that the content model data rtk cache is invalidated when a block model is generated via AI so that the subapp nav will immediately contain the newly-generated block.
Resolves #3923

Screencast_20251204_094345.webm

@finnar-bin finnar-bin self-assigned this Dec 4, 2025
@finnar-bin finnar-bin added the bug Something isn't working label Dec 4, 2025
}

// Makes sure that the subapp sidebar data is refreshed
if (response.type === "NAVIGATE") {
Copy link
Contributor

Choose a reason for hiding this comment

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

This means that everytime the model responds with a navigate action it refetches regardless if the user even clicked on the navigate button.

In addition the navigate action is context free it may navigate to settings for example so there are cases where there is no need to refetch content models

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@agalin920 I've updated it to only perform a refetch when the response path contains "blocks", this way it would only refetch when a new block is generated. I decided to perform the refetch as soon as the response is received from the mcp, this way even if the user was already on the blocks app the sidebar would automatically get updated instead of having to wait for the user to click the Navigate button before doing the refetch.

Copy link
Contributor

@agalin920 agalin920 Dec 9, 2025

Choose a reason for hiding this comment

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

This is a bit too brittle. Let's talk to @mattezra to return the created entities as part of the response so it can be applied to any entity that we may support in the future.

For now simply ensuring blocks get refreshed when navigating to the blocks app should suffice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

return the crested entities as part of the response so it can be applied to any entity that we may support in the future.

@agalin920 I'm not sure I understand what this is for.

Also, are you suggesting the refetch be done once the navigate button is clicked? If so, what if the user decided to not click the navigate button, wouldn't that mean that they won't be able to see the new block item on the subapp sidebar until it gets refetched some other way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed, I have moved the refetch call to the onClick of the navigate button

Copy link
Contributor

Choose a reason for hiding this comment

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

@finnar-bin that wasn't really the solution discussed. The solution we want as part of this is to gurantee block model refetch when navigating to the blocks app

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@agalin920 updated the pr

@finnar-bin finnar-bin requested a review from agalin920 December 9, 2025 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blocks - Newly-created AI-generated block model does not show up on the subapp nav

3 participants