Skip to content

Commit bf803e1

Browse files
committed
fix(editor): fix "after back to UserCenter from ElementAssemble->select contribute from market->enter AssembleSpace, canvas size and selected ui controls are reset" bug
1 parent 4cbc6fe commit bf803e1

14 files changed

Lines changed: 220 additions & 70 deletions

File tree

defaults/meta3d-commonlib/lib/bs/.bsdeps

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ src\log 0x1.a5a64897c2f18p+30
1818
src\copy 0x1.a5a64897c0e59p+30
1919
src\contract 0x1.a5a64897bfdf9p+30
2020
===
21-
D:\Github\Meta3D\node_modules\rescript\win32\rescript.exe 0x1.a6afc512ab821p+30
21+
D:\Github\Meta3D\node_modules\rescript\win32\rescript.exe 0x1.a6b00216aeb1dp+30
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Start(32910227)
2-
#Done(32910235)
1+
#Start(36813540)
2+
#Done(36813546)

doc/1.3.1.org

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,9 +1685,14 @@ TODO skill data
16851685
# store in s/b_value
16861686

16871687

1688-
TODO not error alert
1689-
1690-
TODO fix: ui miss?
1688+
# TODO feat: add continue assemble button
1689+
# TODO fix button handler: enter assemble
1690+
TODO fix back to UserCenter
1691+
TODO fix: canvas size miss
1692+
TODO fix: ui reset
1693+
TODO fix: new ui control should update
1694+
should reset all except element store
1695+
TODO fix: should keep app name
16911696

16921697

16931698

@@ -1742,6 +1747,9 @@ unitmod
17421747

17431748
# *** TODO add editor ui
17441749

1750+
* TODO run element: not error alert while already show error message
1751+
1752+
17451753

17461754
* TODO update
17471755

platform/frontend/src/external_layer/ui/app/assemble_space/components/AssembleSpace.res

Lines changed: 118 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ type view =
99
| Package
1010

1111
module Method = {
12-
let resetWhenEnter = dispatch => {
13-
dispatch(AssembleSpaceStoreType.ResetWhenEnter)
12+
let resetWhenEnter = ( dispatch,dispatchForElementAssembleStore, isFromEnter, isFromEdit ) => {
13+
( isFromEnter || isFromEdit ) ?
14+
dispatch(AssembleSpaceStoreType.ResetWhenEnterFromEnter)
15+
:
16+
{ dispatch(AssembleSpaceStoreType.ResetWhenEnter)
17+
dispatchForElementAssembleStore(
18+
ElementAssembleStoreType.SetCanvasData(({width: 0, height: 0}: Meta3dType.Index.canvasData)),
19+
)
20+
}
1421
}
1522

1623
let _merge = (mergedCustoms, customs) => {
@@ -24,6 +31,14 @@ module Method = {
2431
2532
2633
34+
35+
36+
37+
38+
39+
40+
41+
2742
now just remove duplicate one, but need handle more:
2843
2944
@@ -35,6 +50,22 @@ now just remove duplicate one, but need handle more:
3550
3651
3752
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+
3869
3970
4071
@@ -48,6 +79,14 @@ compare equal(first length, then all)?{
4879
4980
5081
82+
83+
84+
85+
86+
87+
88+
89+
5190
use local input
5291
5392
@@ -56,6 +95,14 @@ use local input
5695
5796
5897
98+
99+
100+
101+
102+
103+
104+
105+
59106
} :{
60107
61108
@@ -64,6 +111,14 @@ use local input
64111
65112
66113
114+
115+
116+
117+
118+
119+
120+
121+
67122
remain one custom input;
68123
69124
@@ -72,6 +127,14 @@ remain one custom input;
72127
73128
74129
130+
131+
132+
133+
134+
135+
136+
137+
75138
rename another custom input's name to add post fix:"_copy";
76139
77140
@@ -80,6 +143,14 @@ rename another custom input's name to add post fix:"_copy";
80143
81144
82145
146+
147+
148+
149+
150+
151+
152+
153+
83154
}
84155
85156
@@ -88,6 +159,14 @@ rename another custom input's name to add post fix:"_copy";
88159
89160
90161
162+
163+
164+
165+
166+
167+
168+
169+
91170
*/
92171
Meta3dCommonlib.ArraySt.removeDuplicateItemsWithBuildKeyFunc((. {name}: CommonType.custom) => {
93172
name
@@ -124,6 +203,14 @@ rename another custom input's name to add post fix:"_copy";
124203
125204
126205
206+
207+
208+
209+
210+
211+
212+
213+
127214
now just replace add duplicate one, but need handle more
128215
129216
@@ -132,6 +219,14 @@ now just replace add duplicate one, but need handle more
132219
133220
134221
222+
223+
224+
225+
226+
227+
228+
229+
135230
*/
136231
customs
137232
->Meta3dCommonlib.ListSt.filter((custom: CommonType.custom) => {
@@ -159,6 +254,14 @@ now just replace add duplicate one, but need handle more
159254
160255
161256
257+
258+
259+
260+
261+
262+
263+
264+
162265
now just replace add duplicate one, but need handle more
163266
164267
@@ -167,6 +270,14 @@ now just replace add duplicate one, but need handle more
167270
168271
169272
273+
274+
275+
276+
277+
278+
279+
280+
170281
*/
171282
customs
172283
->Meta3dCommonlib.ListSt.filter((custom: CommonType.custom) => {
@@ -304,8 +415,7 @@ now just replace add duplicate one, but need handle more
304415
{protocol, displayName, children}: BackendCloudbaseType.uiControl,
305416
) => {
306417
switch selectedUIControls->Meta3dCommonlib.ArraySt.find(((selectedUIControl, _)) => {
307-
selectedUIControl.data.contributePackageData.protocol.name == protocol.name
308-
&&
418+
selectedUIControl.data.contributePackageData.protocol.name == protocol.name &&
309419
Meta3d.Semver.gte(
310420
Meta3d.Semver.minVersion(
311421
selectedUIControl.data.contributePackageData.protocol.version,
@@ -483,7 +593,7 @@ now just replace add duplicate one, but need handle more
483593
// let mergedCustomInputs = _mergeCustoms(selectedElementsFromMarket)
484594

485595
dispatchForElementAssembleStore(
486-
ElementAssembleStoreType.Import(
596+
ElementAssembleStoreType.ImportWhenEmpty(
487597
selectedUIControls,
488598
_generateSelectedUIControlInspectorData(mergedUIControls, selectedUIControls),
489599
// mergedCustomInputs,
@@ -513,6 +623,8 @@ let make = (
513623
~selectedContributesFromMarket: selectedContributesFromMarket,
514624
~selectedElementsFromMarket: selectedElementsFromMarket,
515625
~assembleSpaceNavTarget: React.ref<Js.Nullable.t<'a>>,
626+
~isFromEnter: bool,
627+
~isFromEdit: bool,
516628
) => {
517629
let dispatch = service.react.useDispatch()
518630
let dispatchForAppStore = service.app.useDispatch()
@@ -533,7 +645,7 @@ let make = (
533645
let (openHelpDrawer, setOpenHelpDrawer) = service.react.useState(_ => false)
534646

535647
service.react.useEffectOnce(() => {
536-
Method.resetWhenEnter(dispatch)
648+
Method.resetWhenEnter(dispatch, dispatchForElementAssembleStore, isFromEnter, isFromEdit)
537649

538650
MessageUtils.showCatchedErrorMessage(() => {
539651
let (customInputs, customActions) =

platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/store/ElementAssembleStore.res

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ let reducer = (state, action) => {
486486
data => {
487487
...data,
488488
input: inputNameOpt->Meta3dCommonlib.OptionSt.map((inputName): input => {
489-
inputName: inputName,
489+
inputName,
490490
inputParams: params,
491491
}),
492492
},
@@ -565,12 +565,19 @@ let reducer = (state, action) => {
565565
// },
566566
// },
567567
// }
568-
| Import(selectedUIControls, selectedUIControlInspectorData) => {
569-
...state,
568+
| ImportWhenEmpty(
570569
selectedUIControls,
571570
selectedUIControlInspectorData,
572-
// isImportElement: true,
573-
}
571+
) => state.selectedUIControls->Meta3dCommonlib.ListSt.length > 0
572+
? {
573+
state
574+
}
575+
: {
576+
...state,
577+
selectedUIControls,
578+
selectedUIControlInspectorData,
579+
// isImportElement: true, }
580+
}
574581
// | ImportElementCustom(customInputs) => {
575582
// ...state,
576583
// customInputs,

platform/frontend/src/external_layer/ui/app/assemble_space/store/AssembleSpaceStore.res

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ let reducer = (state, action) => {
1717
PackageAssembleStoreType.ResetWhenEnter,
1818
),
1919
}
20+
| ResetWhenEnterFromEnter => {
21+
...state,
22+
apAssembleState: ApAssembleStore.reducer(
23+
state.apAssembleState,
24+
ApAssembleStoreType.ResetWhenEnter,
25+
),
26+
packageAssembleState: PackageAssembleStore.reducer(
27+
state.packageAssembleState,
28+
PackageAssembleStoreType.ResetWhenEnter,
29+
),
30+
}
2031
| ResetWhenSwitch => {
2132
...state,
2233
apAssembleState: ApAssembleStore.reducer(
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
let resetWhenLeave = dispatchForElementAssembleStore => {
2-
dispatchForElementAssembleStore(
3-
ElementAssembleStoreType.SetCanvasData(({width: 0, height: 0}: Meta3dType.Index.canvasData)),
4-
)
5-
}
1+
// let resetWhenLeave = dispatchForElementAssembleStore => {
2+
// dispatchForElementAssembleStore(
3+
// ElementAssembleStoreType.SetCanvasData(({width: 0, height: 0}: Meta3dType.Index.canvasData)),
4+
// )
5+
// }

0 commit comments

Comments
 (0)