mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 06:35:20 +00:00
fix: resolve map rendering in sub-details and incorrect value display for empty fields (#5526)
* fix: bug * fix: test
This commit is contained in:
parent
eb5e23f686
commit
67e1373077
@ -2,9 +2,7 @@
|
||||
"version": "1.3.42-beta",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"npmClientArgs": [
|
||||
"--ignore-engines"
|
||||
],
|
||||
"npmClientArgs": ["--ignore-engines"],
|
||||
"command": {
|
||||
"version": {
|
||||
"forcePublish": true,
|
||||
|
@ -142,6 +142,8 @@ export const useDetailsBlockProps = () => {
|
||||
.reset()
|
||||
.then(() => {
|
||||
ctx.form.setInitialValues(data || {});
|
||||
ctx.form.setValues(data || {});
|
||||
|
||||
// Using `ctx.form.setValues(data || {});` here may cause an internal infinite loop in Formily
|
||||
})
|
||||
.catch(console.error);
|
||||
|
@ -159,7 +159,7 @@ test.describe('form item & edit form', () => {
|
||||
gotoPage: async () => {
|
||||
record = await (async (mockPage, mockRecord) => {
|
||||
const nocoPage = await mockPage(oneTableBlockWithAddNewAndViewAndEditAndChoicesFields).waitForInit();
|
||||
const record = await mockRecord('general');
|
||||
const record = await mockRecord('general', { checkbox: false });
|
||||
await nocoPage.goto();
|
||||
|
||||
return record;
|
||||
|
@ -27,7 +27,6 @@ export const MapComponent = React.forwardRef<any, any>((props, ref) => {
|
||||
if (!Component) {
|
||||
return <div>{t(`The ${mapType} cannot found`)}</div>;
|
||||
}
|
||||
|
||||
return <Component ref={ref} {...props} />;
|
||||
});
|
||||
MapComponent.displayName = 'MapComponent';
|
||||
|
@ -7,7 +7,7 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { useFieldSchema, useForm } from '@formily/react';
|
||||
import { useField, useFieldSchema, useForm } from '@formily/react';
|
||||
import { EllipsisWithTooltip, useCollection_deprecated, useFieldTitle } from '@nocobase/client';
|
||||
import React from 'react';
|
||||
import { MapComponent } from './MapComponent';
|
||||
@ -19,9 +19,9 @@ const ReadPretty = (props) => {
|
||||
const collectionField = getField(fieldSchema.name);
|
||||
const mapType = props.mapType || collectionField?.uiSchema['x-component-props']?.mapType;
|
||||
const form = useForm();
|
||||
const field = useField();
|
||||
useFieldTitle();
|
||||
|
||||
if (!form.readPretty) {
|
||||
if (!form.readPretty || field.readPretty) {
|
||||
return (
|
||||
<div>
|
||||
<EllipsisWithTooltip ellipsis={true}>
|
||||
|
Loading…
Reference in New Issue
Block a user