Skip to content

Conversation

@briangregoryholmes
Copy link
Contributor

@briangregoryholmes briangregoryholmes commented Dec 22, 2025

Canvas entity access is currently guarded by the CanvasInitialization component that retrieves existing canvas entities in the registry and creates new ones if necessary. Canvas entities are keyed on a combination of the canvas name and instanceId.

However, after the initial application load, calls to setRuntime in load functions trigger updates to the runtime store before the rest of the load and CanvasInitialization functions can run again. As such, when navigating from a canvas to a different project, the instanceId will change prior to the components being unmounted, causing them to attempt to access a new canvas keyed on a instanceId/name combination that doesn't exist.

This PR attempts to fix that issue by removing calls to setRuntime within the load functions. This may cause issues when trying to fetch data in load functions if accessing the runtime data from the store rather than the parent load function data. As mentioned in #8534, this sequence requires a thoughtful overhaul.

Adds test to ensure navigation is possible.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@briangregoryholmes briangregoryholmes self-assigned this Dec 22, 2025
@ericpgreen2
Copy link
Contributor

The code change looks reasonable to me, but I do see the errors in the failing CI test, where it looks like some Canvas queries are firing without an instanceID.

image

runtime: runtimeData,
} = await fetchProjectDeploymentDetails(organization, project, token);

await runtime.setRuntime(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will cause issues in other places that make a call to runtime in loader function. We should either replace all instances of such calls or keep this and revert back to how things worked before #8391

Copy link
Contributor Author

@briangregoryholmes briangregoryholmes Dec 23, 2025

Choose a reason for hiding this comment

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

That's the main point of this PR. There shouldn't be any calls/subscriptions to the runtime store in the loader functions. I just checked and really only found a call to openQuery, which I've refactored slightly. Please let me know if there are any others you're aware of. #8391 did not change anything meaningfully related to this behavior, it simply exposed that there was an underlying issue.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I updated a few more routes. Also fixed openQuery, it was passing jwt and host.

@briangregoryholmes
Copy link
Contributor Author

briangregoryholmes commented Dec 23, 2025

@ericpgreen2 Added guards to the relevant queries so that they're not enabled if instanceId is not set, something that should have always been the case.

The types here are lacking since it's very much possible (depending on what route you're on) that instanceId is undefined. Usually components that require an instanceId shouldn't be rendered when it is undefined, but this is not true of TopNavigationBar, which exists further up the tree than the RuntimeProvider, but still makes calls to things that require an instanceId. I hope to change this when we tackle the larger refactor of this sequence.

@briangregoryholmes briangregoryholmes added Bug blocker A release blocker issue that should be resolved before a new release patch labels Dec 23, 2025
@AdityaHegde AdityaHegde dismissed their stale review December 24, 2025 05:46

Changed a few things myself. Will leave it up to @ericpgreen2 to approve

@AdityaHegde AdityaHegde removed their request for review December 30, 2025 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker A release blocker issue that should be resolved before a new release Bug patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants