Behaviour between draft articles and apps with extension point on articles
Hi,
I'm building an App with the extension points ARTICLE_ABOVE_ACTIVITY_STREAM and ARTICLE_OPTIONS_MENU_ITEM. And the first action the widgets do, is to load some information from the article's extension properties using an HTTP handler.
This works for normal articles which is to be expected. However for draft articles this always fails with the following error:
class jetbrains.youtrack.article.persistent.XdArticleDraft cannot be cast to class jetbrains.youtrack.core.persistent.article.XdArticle (jetbrains.youtrack.article.persistent.XdArticleDraft and jetbrains.youtrack.core.persistent.article.XdArticle are in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @6c14f4a7)My question now is: What is the intended way to check if the article is a draft in order to prevent errors happening?
Please sign in to leave a comment.
Hi! Thanks for reporting this, it looks like a bug. We've shared it with the team: JT-90889.
Until it's fixed, as a workaround, you could introduce a message in the HTML part of the app like so: “Loading or waiting for the article to be published...”. This could help to avoid confusion and set the expectation that the article should be published before the widget can start displaying any content.
Hi, thank you for help
We're glad to help! Feel free to reach out again if you notice anything else or if you get other questions.