fix(mobile): avoid crashing (#5109)

This commit is contained in:
Zeke Zhang 2024-08-23 09:46:53 +08:00 committed by GitHub
parent aa68a739c0
commit db33645821
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View File

@ -292,7 +292,7 @@ export const PagePopups = (props: { paramsList?: PopupParams[] }) => {
setRootSchema(rootSchema);
};
run();
}, [fieldSchema.root, getPopupSchemaFromSchema, popupParams, requestSchema, savePopupSchemaToSchema]);
}, [fieldSchema, getPopupSchemaFromSchema, popupParams, requestSchema, savePopupSchemaToSchema]);
const components = useMemo(() => ({ PagePopupsItemProvider }), []);
@ -444,7 +444,7 @@ function findSchemaByUid(uid: string, rootSchema: Schema, resultRef: { value: Sc
resultRef = resultRef || {
value: null,
};
rootSchema.mapProperties((schema) => {
rootSchema?.mapProperties?.((schema) => {
if (schema['x-uid'] === uid) {
resultRef.value = schema;
} else {

View File

@ -7,16 +7,16 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import React, { FC, useCallback } from 'react';
import { Space, Tabs, TabsProps } from 'antd-mobile';
import { useParams, useNavigate, Navigate } from 'react-router-dom';
import React, { FC, useCallback } from 'react';
import { Navigate, useNavigate, useParams } from 'react-router-dom';
import { useMobileRoutes } from '../../../../mobile-providers';
import { DndContext, DndContextProps, Icon, SortableItem } from '@nocobase/client';
import { useStyles } from './styles';
import { MobilePageTabsSettings } from './settings';
import { MobilePageTabInitializer } from './initializer';
import { useMobileRoutes } from '../../../../mobile-providers';
import { useMobilePage } from '../../context';
import { MobilePageTabInitializer } from './initializer';
import { MobilePageTabsSettings } from './settings';
import { useStyles } from './styles';
export const MobilePageTabs: FC = () => {
const { activeTabBarItem, resource, refresh } = useMobileRoutes();
@ -26,7 +26,7 @@ export const MobilePageTabs: FC = () => {
const { styles } = useStyles();
const { tabSchemaUid } = useParams<{ tabSchemaUid: string }>();
const [activeKey, setActiveKey] = React.useState<string>(() => {
return tabSchemaUid || activeTabBarItem?.children[0]?.schemaUid;
return tabSchemaUid || activeTabBarItem?.children?.[0]?.schemaUid;
});
const handleChange: TabsProps['onChange'] = (schemaUid) => {
setActiveKey(schemaUid);