mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2024-11-21 03:15:49 +08:00
fix: fixed the bug where repeatedly clicking on the currently edited application would cause the stateManager's store to be cleared
This commit is contained in:
parent
c03707ec41
commit
e7a8b5954d
@ -58,7 +58,7 @@ export const StructureTree: React.FC<Props> = props => {
|
||||
}, [selectedComponentId]);
|
||||
|
||||
return (
|
||||
<VStack ref={wrapperRef} height='full' spacing="2" padding="4" alignItems="start" overflowWrap='break-word' overflowX='hidden' overflowY="auto">
|
||||
<VStack ref={wrapperRef} height='full' spacing="2" padding="4" alignItems="start" overflowX='hidden' overflowY="auto">
|
||||
<Text fontSize="lg" fontWeight="bold" mb="0.5rem">
|
||||
Components
|
||||
</Text>
|
||||
|
@ -17,6 +17,7 @@ import {
|
||||
CORE_VERSION,
|
||||
CoreComponentName,
|
||||
} from '@sunmao-ui/shared';
|
||||
import { isEqual } from 'lodash-es';
|
||||
|
||||
type EditingTarget = {
|
||||
kind: 'app' | 'module';
|
||||
@ -77,7 +78,12 @@ export class EditorStore {
|
||||
// when switch app or module, components should refresh
|
||||
reaction(
|
||||
() => this.currentEditingTarget,
|
||||
target => {
|
||||
(target, prevTarget) => {
|
||||
|
||||
if (isEqual(prevTarget, target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.name) {
|
||||
this.setCurrentComponentsVersion(0);
|
||||
this.setLastSavedComponentsVersion(0);
|
||||
@ -175,7 +181,7 @@ export class EditorStore {
|
||||
}
|
||||
|
||||
get activeDataSource(): ComponentSchema | null {
|
||||
return this.components.find((component)=> component.id === this.activeDataSourceId) || null;
|
||||
return this.components.find((component) => component.id === this.activeDataSourceId) || null;
|
||||
}
|
||||
|
||||
get activeDataSourceType(): DataSourceType | null {
|
||||
|
Loading…
Reference in New Issue
Block a user