Handle Direct Url Navigation using Decompose Library in Compose Multiplatform

I am creating a website and an app using compose multiplatform and I have set up the navigation as below:

@OptIn(ExperimentalDecomposeApi::class)
interface MyStackComponent : WebNavigationOwner {
    val stack: Value<ChildStack<*, RootComponent.Child>>
}

@OptIn(ExperimentalDecomposeApi::class)
class RootComponent(
    componentContext: ComponentContext,
    deepLinkUrl: String? = null,
) : MyStackComponent, ComponentContext by componentContext {

    private val navigation = StackNavigation<Configuration>()
    
    private val _stack: Value<ChildStack<Configuration, Child>> = childStack(
        source = navigation,
        serializer = Configuration.serializer(),
        initialStack = { initialConfig(deepLinkUrl) },
        handleBackButton = true,
        childFactory = ::createChild
    )

    override val stack: Value<ChildStack<*, Child>> = _stack

    override val webNavigation: WebNavigation<*> = childStackWebNavigation(
        navigator = navigation,
        stack = _stack,
        serializer = Configuration.serializer(),
        pathMapper = { child -> child.configuration.path },
        childSelector = { child -> child.instance as? WebNavigationOwner },
    )
    
    private fun createChild(
        config: Configuration, context: ComponentContext
    ): Child {
        return when (config) {
            is Configuration.HomeScreen -> Child.Home(
                HomeComponent(componentContext = context,
                    navigateToBlogScreen = { id -> navigation.pushNew(Configuration.BlogScreen(id)) })
            )

            is Configuration.BlogScreen -> Child.Blog(
                BlogComponent(
                    id = config.id,
                    componentContext = context,
                    navigateBack = { navigation.pop() })
            )

            Configuration.EditorScreen -> Child.Editor(EditorComponent(componentContext = context))
            Configuration.IndexerScreen -> Child.Indexer(IndexerComponent(componentContext = context))
            Configuration.PortfolioScreen -> Child.Portfolio(PortfolioComponent(componentContext = context))
            Configuration.PrivacyPolicyScreen -> Child.PrivacyPolicy(
                PrivacyPolicyComponent(
                    componentContext = context
                )
            )

            is Configuration.SearchScreen -> Child.Search(
                SearchComponent(
                    componentContext = context, key = config.key
                )
            )
        }

    }

    sealed class Child {
        class Home(val component: HomeComponent) : Child()
        class Blog(val component: BlogComponent) : Child()
        class Editor(val component: EditorComponent) : Child()
        class Indexer(val component: IndexerComponent) : Child()
        class Portfolio(val component: PortfolioComponent) : Child()
        class PrivacyPolicy(val component: PrivacyPolicyComponent) : Child()
        class Search(val component: SearchComponent) : Child()

    }

    @Serializable
    sealed class Configuration(val path: String) {
        @Serializable
        data object HomeScreen : Configuration("/")

        @Serializable
        data object EditorScreen : Configuration("/editor")

        @Serializable
        data object IndexerScreen : Configuration("/indexer")

        @Serializable
        data object PrivacyPolicyScreen : Configuration("/privacy-policy")

        @Serializable
        data object PortfolioScreen : Configuration("/portfolio")


        @Serializable
        data class BlogScreen(val id: String) : Configuration("/blog/$id")

        @Serializable
        data class SearchScreen(val key: String) : Configuration("/search/$key")


    }

    private fun initialConfig(deepLinkUrl: String?): List<Configuration> {
        // Parse the deep link and initialize navigation state
        val deepLink = deepLinkUrl?.let { parseDeepLink(it) }
        return if (deepLink != null) {
            listOf(deepLink)
        } else {
            listOf(Configuration.HomeScreen)
        }
    }

    fun parseDeepLink(url: String): Configuration? {
        val uri = URI(url)
        val pathSegments = uri.path().split("/").filter { it.isNotEmpty() }

        return when {
            pathSegments.isEmpty() -> Configuration.HomeScreen

            pathSegments.contains("editor") -> Configuration.EditorScreen
            pathSegments.contains("indexer") -> Configuration.IndexerScreen
            pathSegments.contains("privacy-policy") -> Configuration.PrivacyPolicyScreen
            pathSegments.contains("portfolio") -> Configuration.PortfolioScreen

            pathSegments.size == 2 && pathSegments[0] == "blog" -> {
                val id = pathSegments[1]
                Configuration.BlogScreen(id)
            }

            pathSegments.size == 2 && pathSegments[0] == "search" -> {
                val key = pathSegments[1]
                Configuration.SearchScreen(key)
            }

            else -> null
        }
    }


}
@Preview
@Composable
fun App(root: RootComponent) {

    if (!isAndroid())
        initKoin()
    
    MaterialTheme {
        Children(
            stack = root.stack,
            modifier = Modifier,
            animation = stackAnimation(slide()),
        ) { child ->
            when (val instance = child.instance) {
                is RootComponent.Child.Home -> HomeScreen(instance.component)
                is RootComponent.Child.Blog -> BlogScreen(instance.component)
                is RootComponent.Child.Editor -> EditorScreen(instance.component)
                is RootComponent.Child.Indexer -> IndexerScreen(instance.component)
                is RootComponent.Child.Portfolio -> PortfolioScreen(instance.component)
                is RootComponent.Child.PrivacyPolicy -> PrivacyPolicyScreen(instance.component)
                is RootComponent.Child.Search -> SearchScreen(instance.component)
            }
        }
    }
}
fun main() {
    ComposeViewport(document.body!!) {
        val lifecycle = LifecycleRegistry()
        val root = withWebHistory{stateKeeper, deepLink ->
            RootComponent(
                DefaultComponentContext(lifecycle, stateKeeper),
                deepLinkUrl = deepLink
            )
        }
                App(root)
    }

}

So when I am starting the web app using wasmJsBrowserRun it is running correctly and navigation is also working fine when navigating form home->blog or home->portfolio etc. but when ever I am trying to directly hit any URL then the application is breaking and giving me a white page.

Ex : Hitting localhost:8080 then click on button to go to localhost:8080/blog/blogid works fine
but directly hitting hitting localhost:8080/blog/blogid is giving white page

This is my repo link: https://github.com/NeilSayok/BlueLabsCMP

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật