Skip to content

Make MarkdownController and StreamedMarkdownController lifecycle methods async #144

Description

@junyan72

Summary

The lifecycle methods on MarkdownController and StreamedMarkdownController are currently synchronous, even though every call site invokes them from an async context (.task { ... }) or a place where a Task { } wrapper is already implied.

Marking them async lets the call sites await them directly, aligns the controllers with the package's Swift-concurrency conventions (AGENTS.md), and keeps the async boundary explicit at the view layer.

Methods to convert:

  • StreamedMarkdownController.start() / end()
  • MarkdownController.onAppear(markdown:) / onDisappear()

The fire-and-forget interaction hooks (onTableCopyTap, onImageTap, etc.) and the sync onChange(markdown:) yield-into-continuation method are intentionally left synchronous, since their call sites are non-async UIKit/AppKit delegates and SwiftUI action closures.

Motivation

  • Call sites already run inside .task { } (an async context), so await-ing is natural and avoids implicit fire-and-forget.
  • Makes the concurrency boundary explicit and consistent across the two controllers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions