Skip to content

Commit

Permalink
Merge pull request #5266 from systeminit/wendy/bug-729-multiple-click…
Browse files Browse the repository at this point in the history
…s-required-to-be-able-to-bind-an-output-socket

fix(web) - BUG-729, multiple clicks, recomputing unmounting
  • Loading branch information
wendybujalski authored Jan 15, 2025
2 parents bebdfe9 + c9dfe1a commit 1c713bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions app/web/src/components/AssetDetailIntrinsicInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ const label = computed<string>(() => {
watch(
() => props.data,
() => {
display.value = toRaw(props.data);
// we need to make a shallow copy of props.data
// in order to prevent the parent AssetDetailsPanel from
// recomputing outputSocketIntrinsics which causes this component
// to be unmounted/mounted which resets the selectedFilter :(
display.value = { ...toRaw(props.data) };
},
{ immediate: true },
);
Expand Down Expand Up @@ -150,10 +154,12 @@ const selectFilter = (item: DropdownFilter) => {
selectedFilter.value = item;
const c = { ...display.value };
if (item === "unset") {
emit("changeToUnset", display.value);
emit("changeToUnset", c);
} else {
emit("changeToIdentity", display.value, null);
emit("changeToIdentity", c, null);
}
};
Expand Down
5 changes: 3 additions & 2 deletions app/web/src/components/AssetDetailsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ const updateOutputSocketIntrinsics = async (data: IntrinsicDisplay) => {
const changeToUnset = (config: PropDisplay | IntrinsicDisplay | undefined) => {
if (!config) return;
config.attributePrototypeId = undefined;
config.funcId = unsetFuncId.value;
config.value = undefined;
Expand All @@ -565,7 +564,9 @@ const changeToIdentity = (
// dont fire a save if there isnt a value
if ("backendKind" in config) {
config.backendKind = FuncBackendKind.Identity;
if (config.value) updateOutputSocketIntrinsics(config);
if (config.value) {
updateOutputSocketIntrinsics(config);
}
} else if (config.value) {
updatePropIntrinsics(config);
}
Expand Down

0 comments on commit 1c713bf

Please sign in to comment.