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

Make sure old style references are backwards compatible #780

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/toolpad-app/src/appDom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,13 @@ export function deref(nodeRef: NodeReference): NodeId;
export function deref(nodeRef: null | undefined): null;
export function deref(nodeRef: Maybe<NodeReference>): NodeId | null;
export function deref(nodeRef: Maybe<NodeReference>): NodeId | null {
if (typeof nodeRef === 'string') {
// This branch provides backwards compatibility for old style string refs
// TODO: remove this branch and replace with a migration after the functionality is in place .
// See https://github.com/mui/mui-toolpad/pull/776
// In migration '1' we should update all query connectionId and navigate action pageId.
return nodeRef;
}
if (nodeRef) {
return nodeRef.$$ref;
}
Expand Down