Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

thpessato
New Contributor III

Remove object from the dev-hub / Remove promise

When I delete a qlik object from the dev-hub, any promise that is right next to it it doesn't get deleted, and throws me syntax error.

Example:

app.getObject('object-01', 'AdjhthZ').then(function(){
     console.log('hey you!');
});

If i delete this object right from the 'preview' screen, it doesn't remove the '.then(....' line.

So, deleting from the preview, it keeps like this:

.then(function(){

     console.log('hey you!');

});

Is there any way to achieve this 'automatic' delete?

Thanks!

Tags (3)
1 Solution

Accepted Solutions
thpessato
New Contributor III

Re: Remove object from the dev-hub / Remove promise

Hey Jonas,

Just realized that the dev-hub doesn't actually look for the original content like you said, but it searches for the first occurrence of ';'


If you remove a object that is just like this:

app.getObject('obj1', 'objectId').then(function(){
    console.log('hey')
});

It will remove all the lines, including console.log and the '})'.

If you remove

app.getObject('obj1', 'objectId').then(function(){

    console.log('hey');

});

It will remove the two first lines, and the last will remain.

4 Replies
bgk
New Contributor III

Re: Remove object from the dev-hub / Remove promise

This feature not been implemented in dev-hub. The editor looks for the original content and any added content by the user will not be considered.

thpessato
New Contributor III

Re: Remove object from the dev-hub / Remove promise

I see. Do you think it would interesting to develop this in the future? Since it's a property provided by the getObject method and it doesn't makes sense to keep the '.then(...' in the code.

thpessato
New Contributor III

Re: Remove object from the dev-hub / Remove promise

Hey Jonas,

Just realized that the dev-hub doesn't actually look for the original content like you said, but it searches for the first occurrence of ';'


If you remove a object that is just like this:

app.getObject('obj1', 'objectId').then(function(){
    console.log('hey')
});

It will remove all the lines, including console.log and the '})'.

If you remove

app.getObject('obj1', 'objectId').then(function(){

    console.log('hey');

});

It will remove the two first lines, and the last will remain.

bgk
New Contributor III

Re: Remove object from the dev-hub / Remove promise

You are right. The intention is to look for the original content but since it is using regexp it find close matches. I will add your suggestion as an improvement suggestion.

Community Browser