Qlik Community

Ask a Question

Integration, Extension & APIs

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

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
thpessato
Contributor III
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!

1 Solution

Accepted Solutions
thpessato
Contributor III
Contributor III
Author

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.

View solution in original post

4 Replies
bgk
Employee
Employee

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
Contributor III
Contributor III
Author

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
Contributor III
Contributor III
Author

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.

View solution in original post

bgk
Employee
Employee

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.