backend: Fix appendChildren TypeError #136
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/backend-to-html-typeerror"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In #134, the mention
MfmNode
handler was made async to allow thementionedUsers query to be used there. This however changed the return
type of that handler to be a
Promise
, causing aTypeError
inappendChildren
.This fixes the
TypeError
by making every handler and theappendChildren
function also async and awaiting on the processed children.
This also attempts to fix the types issue with handlers by casting to
the newly defined
HandlerFunc
type instead of toany
.19b4360e1c
to319ec40bd3
seems a quite important fix and also working. just one minor nitpick
@ -170,0 +167,4 @@
async function appendChildren(children: mfm.MfmNode[], targetElement: HTMLElement): Promise<void> {
type HandlerFunc = (node: mfm.MfmNode) => Promise<Node>;
const htmlChildren = await Promise.all(children.map(x => (handlers[x.type] as HandlerFunc)(x)));
fixed.
e709902540
toffa1954fb1
ffa1954fb1
to9bcc247421