Added check when is_component equals null
This commit is contained in:
parent
5b2ad174f3
commit
02f68b63a0
4 changed files with 7 additions and 6 deletions
|
|
@ -639,8 +639,7 @@ export function FlowsProvider({ children }: { children: ReactNode }) {
|
|||
}
|
||||
|
||||
async function saveFlow(newFlow: FlowType, silent?: boolean) {
|
||||
if (newFlow?.data?.nodes?.length === 0) return;
|
||||
|
||||
console.log(newFlow);
|
||||
try {
|
||||
// updates flow in db
|
||||
const updatedFlow = await updateFlowInDatabase(newFlow);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export default function FlowSettingsModal({
|
|||
useEffect(() => {
|
||||
const tempNameList: string[] = [];
|
||||
flows.forEach((flow: FlowType) => {
|
||||
if (flow.is_component === false) tempNameList.push(flow.name);
|
||||
if ((flow.is_component ?? false) === false) tempNameList.push(flow.name);
|
||||
});
|
||||
setNameList(tempNameList.filter((name) => name !== flow!.name));
|
||||
}, [flows]);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ export default function ShareModal({
|
|||
filterByUser: true,
|
||||
}).then((res) => {
|
||||
res?.results?.forEach((element: any) => {
|
||||
if (element.is_component === is_component)
|
||||
console.log(element, is_component);
|
||||
if ((element.is_component ?? false) === is_component)
|
||||
unavaliableNames.push({ name: element.name, id: element.id });
|
||||
});
|
||||
setUnavaliableNames(unavaliableNames);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export default function ComponentsComponent({
|
|||
useEffect(() => {
|
||||
if (isLoading) return;
|
||||
const all = flows
|
||||
.filter((f) => f.is_component === is_component)
|
||||
.filter((f) => (f.is_component ?? false) === is_component)
|
||||
.sort((a, b) => {
|
||||
if (a?.updated_at && b?.updated_at) {
|
||||
return (
|
||||
|
|
@ -179,7 +179,8 @@ export default function ComponentsComponent({
|
|||
pageSize={pageSize}
|
||||
rowsCount={[10, 20, 50, 100]}
|
||||
totalRowsCount={
|
||||
flows.filter((f) => f.is_component === is_component).length
|
||||
flows.filter((f) => (f.is_component ?? false) === is_component)
|
||||
.length
|
||||
}
|
||||
paginate={(pageSize, pageIndex) => {
|
||||
setPageIndex(pageIndex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue