Skip to content

Commit

Permalink
fix: unnecessary loadInstance call
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Nov 23, 2022
1 parent 6a42cdf commit bc4128b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-years-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hydrofoil/shaperone-wc-shoelace": patch
---

When an autocomplete was populated on load, it would unnecessarily call `loadInstance` upon selection
4 changes: 2 additions & 2 deletions packages/wc-shoelace/components/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ export const autocomplete: Lazy<AutoCompleteEditor> & Options = {
initLabel(this: AutoCompleteEditor, { property: { shape }, value, updateComponentState }) {
const {
object,
componentState: { freetextQuery, selectionLoading },
componentState: { freetextQuery, selectionLoading, selected },
} = value

if (object && !freetextQuery && !selectionLoading) {
if (object && !selected && !freetextQuery && !selectionLoading) {
const selectionLoading = this.loadInstance({ property: shape, value: object })
.then((resource) => {
updateComponentState({
Expand Down

0 comments on commit bc4128b

Please sign in to comment.