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