mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-06 06:48:21 +00:00
Changed function response to handle non accessible components.
This commit is contained in:
parent
46ab01fead
commit
1ef408f113
2 changed files with 25 additions and 4 deletions
|
|
@ -32,8 +32,18 @@ const useCallbackActions = () => {
|
|||
};
|
||||
|
||||
const handleAutoScrollToComponent = (data) => {
|
||||
const computedComponentId = getComponentIdToAutoScroll(data.id);
|
||||
if (!computedComponentId) return;
|
||||
const { isAccessible, computedComponentId, isOnCanvas } = getComponentIdToAutoScroll(data.id);
|
||||
if (!isAccessible) {
|
||||
if (isOnCanvas) {
|
||||
toast.success(
|
||||
`This component can't be opened because it's on the main canvas. Close ${computedComponentId} and click "Go to component" to view it there`
|
||||
);
|
||||
} else
|
||||
toast.success(
|
||||
`This component can't be opened because it's inside ${computedComponentId}. Open ${computedComponentId} and click "Go to component"to view it.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
setSelectedComponents([computedComponentId]);
|
||||
const target = document.getElementById(computedComponentId);
|
||||
target.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
|
|
|
|||
|
|
@ -103,8 +103,19 @@ export const createLeftSideBarSlice = (set, get) => ({
|
|||
}
|
||||
|
||||
if (modalsOpenOnCanvas.length > 0 && !isInsideOpenModal) {
|
||||
return undefined;
|
||||
const targetId = visited.size === 1 ? modalsOpenOnCanvas[modalsOpenOnCanvas.length - 1] : current;
|
||||
const componentName = currentPageComponents?.[targetId]?.component?.name;
|
||||
|
||||
return {
|
||||
isAccessible: false,
|
||||
computedComponentId: componentName,
|
||||
isOnCanvas: visited.size === 1,
|
||||
};
|
||||
}
|
||||
return targetComponentId;
|
||||
|
||||
return {
|
||||
isAccessible: true,
|
||||
computedComponentId: targetComponentId,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue