Skip to content

Commit

Permalink
fixed resource-reference spam if ther is no resource-reference on bac…
Browse files Browse the repository at this point in the history
…kend (#2513)
  • Loading branch information
opaduchak authored Feb 24, 2025
1 parent 9e65a67 commit 0f79bf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/packages/addons-service/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class Provider {
@service intl!: Intl;

@tracked node?: NodeModel;
@tracked serviceNode?: ResourceReferenceModel;
@tracked serviceNode?: ResourceReferenceModel | null;

currentUser: CurrentUserService;
@tracked userReference!: UserReferenceModel;
Expand Down Expand Up @@ -115,7 +115,7 @@ export default class Provider {
currentUser: CurrentUserService,
node?: NodeModel,
allConfiguredAddons?: EmberArray<AllConfiguredAddonTypes>,
resourceReference?: ResourceReferenceModel,
resourceReference?: ResourceReferenceModel | null,
userReference?: UserReferenceModel,
) {
setOwner(this, getOwner(provider));
Expand Down Expand Up @@ -179,7 +179,7 @@ export default class Provider {
@task
@waitFor
async getResourceReference() {
if (this.node && !this.serviceNode) {
if (this.node && this.serviceNode === undefined) {
const resourceRefs = await this.store.query('resource-reference', {
filter: {resource_uri: this.node.links.iri?.toString()},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class AddonsServiceManagerComponent extends Component<Args> {
@service toast!: Toast;

node = this.args.node;
@tracked addonServiceNode?: ResourceReferenceModel;
@tracked addonServiceNode?: ResourceReferenceModel | null;
@tracked userReference?: UserReferenceModel;

possibleFilterTypes = Object.values(FilterTypes);
Expand Down Expand Up @@ -341,8 +341,10 @@ export default class AddonsServiceManagerComponent extends Component<Args> {
const references = await this.store.query('resource-reference', {
filter: {resource_uri: this.node.links.iri},
});
if(references) {
this.addonServiceNode = references.firstObject;
if (references) {
this.addonServiceNode = references.firstObject || null;
} else {
this.addonServiceNode = null;
}
}

Expand Down

0 comments on commit 0f79bf3

Please sign in to comment.