[2.x] Fixed tags mutation shows [deleted] in some cases, together with improvements#4393
[2.x] Fixed tags mutation shows [deleted] in some cases, together with improvements#4393edgeinfinity1 wants to merge 5 commits intoflarum:2.xfrom
Conversation
imorland
left a comment
There was a problem hiding this comment.
Thanks for the PR! The core approach is sound — detecting uncached tags and re-fetching before rendering is the right direction. A few issues need addressing before this can merge:
Truly deleted tags still produce undefined
The commented-out .filter(Boolean) reveals an unresolved decision:
.map((id) => app.store.getById('tags', id))
// .filter(Boolean);After the fetch, a tag that has been genuinely deleted from the database will still return undefined from getById — it simply won't be in the store. So the [deleted] rendering can still occur, just less frequently (only for truly deleted tags rather than uncached ones).
Please either:
- Uncomment
.filter(Boolean)to silently drop deleted tags from the display, or - Explicitly handle
undefinedentries intagsLabel/ the description text
No error handling on the fetch
If app.store.find('tags') rejects (network error, server error), this.loading stays true forever and the component shows a spinner indefinitely. Please add a .catch():
app.store.find('tags').then(afterFetch).catch(() => {
this.loading = false;
m.redraw();
});Minor: hardcoded height: 62px
.EventPost.DiscussionTaggedPost.Post.Post--loading {
height: 62px;
}Magic number — fragile if the post layout changes. Consider using min-height or deriving from a variable instead.
imorland
left a comment
There was a problem hiding this comment.
Thanks for the PR! The core approach is sound — detecting uncached tags and re-fetching before rendering is the right direction. A few issues need addressing before this can merge:
Truly deleted tags still produce undefined
The commented-out .filter(Boolean) reveals an unresolved decision:
.map((id) => app.store.getById('tags', id))
// .filter(Boolean);After the fetch, a tag that has been genuinely deleted from the database will still return undefined from getById — it simply won't be in the store. So the [deleted] rendering can still occur, just less frequently (only for truly deleted tags rather than uncached ones).
Please either:
- Uncomment
.filter(Boolean)to silently drop deleted tags from the display, or - Explicitly handle
undefinedentries intagsLabel/ the description text
No error handling on the fetch
If app.store.find('tags') rejects (network error, server error), this.loading stays true forever and the component shows a spinner indefinitely. Please add a .catch():
app.store.find('tags').then(afterFetch).catch(() => {
this.loading = false;
m.redraw();
});Minor: hardcoded height: 62px
.EventPost.DiscussionTaggedPost.Post.Post--loading {
height: 62px;
}Magic number — fragile if the post layout changes. Consider using min-height or deriving from a variable instead.


Fixes #0000
As title. If a tag was deleted from a discussion, it will no longer be included in its relationship, causing the DiscussionTaggedPost shows [deleted].
I modernized the component, added loading indicator, and now it will fetch tags list if any uncached tag is mentioned in mutation.
Changes proposed in this pull request:
Reviewers should focus on:
Maybe adding deleted tags in discussions' relationship is a better solution? Though I don't think it's necessary.
Screenshot
Necessity
Confirmed
composer test).Required changes: