mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
null check on .some functions
This commit is contained in:
@@ -48,7 +48,7 @@ export const tablesAtom = atom<TableSettings[]>((get) => {
|
||||
return sortBy(tables, "name")
|
||||
.filter((table) =>
|
||||
userRoles.includes("ADMIN") || Array.isArray(table.roles)
|
||||
? table.roles.some((role) => userRoles.includes(role))
|
||||
? table.roles?.some((role) => userRoles.includes(role))
|
||||
: false
|
||||
)
|
||||
.map((table) => ({
|
||||
|
||||
@@ -72,7 +72,7 @@ export default function ImportAirtableWizard({ onClose }: ITableModalProps) {
|
||||
const newColumns = uniqBy(
|
||||
[...prev.newColumns, ...(value.newColumns ?? [])],
|
||||
"key"
|
||||
).filter((col) => pairs.some((pair) => pair.columnKey === col.key));
|
||||
).filter((col) => pairs?.some((pair) => pair.columnKey === col.key));
|
||||
return { ...prev, pairs, newColumns };
|
||||
});
|
||||
}, []);
|
||||
|
||||
@@ -80,7 +80,7 @@ export default function ImportCsvWizard({ onClose }: ITableModalProps) {
|
||||
const newColumns = uniqBy(
|
||||
[...prev.newColumns, ...(value.newColumns ?? [])],
|
||||
"key"
|
||||
).filter((col) => pairs.some((pair) => pair.columnKey === col.key));
|
||||
).filter((col) => pairs?.some((pair) => pair.columnKey === col.key));
|
||||
|
||||
return { ...prev, pairs, newColumns };
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ function StepComponent({ setComplete }: ITableTutorialStepComponentProps) {
|
||||
const [tableColumnsOrdered] = useAtom(tableColumnsOrderedAtom, tableScope);
|
||||
useEffect(() => {
|
||||
if (
|
||||
tableColumnsOrdered.some(
|
||||
tableColumnsOrdered?.some(
|
||||
(c) =>
|
||||
c.type === FieldType.rating && c.name.toLowerCase().includes("rating")
|
||||
)
|
||||
|
||||
@@ -127,7 +127,9 @@ export default function PopupContents({
|
||||
<Grid item xs>
|
||||
<List sx={{ overflowY: "auto" }}>
|
||||
{hits.map((hit) => {
|
||||
const isSelected = selectedValues.some((v) => v === hit[elementId]);
|
||||
const isSelected = selectedValues?.some(
|
||||
(v) => v === hit[elementId]
|
||||
);
|
||||
return (
|
||||
<MenuItem
|
||||
key={get(hit, elementId)}
|
||||
|
||||
@@ -175,7 +175,7 @@ const getDocRef = <T>(
|
||||
path: string | undefined,
|
||||
pathSegments?: Array<string | undefined>
|
||||
) => {
|
||||
if (!path || (Array.isArray(pathSegments) && pathSegments.some((x) => !x)))
|
||||
if (!path || (Array.isArray(pathSegments) && pathSegments?.some((x) => !x)))
|
||||
return null;
|
||||
|
||||
return doc(
|
||||
|
||||
@@ -84,7 +84,7 @@ export function useTableFunctions() {
|
||||
if (
|
||||
checked &&
|
||||
// Make sure we don’t have
|
||||
!Object.values(columns).some((column) => column.type === type)
|
||||
!Object.values(columns)?.some((column) => column.type === type)
|
||||
)
|
||||
columns["_" + camelCase(type)] = {
|
||||
type,
|
||||
|
||||
Reference in New Issue
Block a user