question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why are the router extensions deprecated?

See original GitHub issue

Since I upgraded to latest versions of Kotlin wrappers, my usages of router extensions are marked as deprecated. The ReplaceWith is broken so I had to manually replace the function calls.

What is the reason for the deprecation? Is there an alternative to using the raw component directly?

It really looks awkward now. I used to have this:

fun RBuilder.application() = hashRouter {
    errorDialog()
    switch {
        route(Route.GAME_BROWSER.path) { gameBrowser() }
        route(Route.GAME.path) { gameScene() }
        route(Route.LOBBY.path) { lobby() }
        route(Route.HOME.path, exact = true) { home() }
        redirect(from = "*", to = "/")
    }
}

And now I have to replace with:

fun RBuilder.application() = HashRouter {
    errorDialog()
    Switch {
        Route {
            attrs.path = arrayOf(Route.GAME_BROWSER.path)
            gameBrowser()
        }
        Route {
            attrs.path = arrayOf(Route.GAME.path)
            gameScene()
        }
        Route {
            attrs.path = arrayOf(Route.LOBBY.path)
            lobby()
        }
        Route {
            attrs.path = arrayOf(Route.HOME.path)
            home()
        }
        Redirect {
            attrs {
                from = "*"
                to = "/"
            }
        }
    }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
francoscommented, Oct 29, 2021

Thanks for getting back to me @sgrishchenko šŸ‘

I totally understand, maintaining and extending those functions as ReactRouter evolves is a lot of work. I think for the time being we’ll have to copy the deprecated functions we are using into our codebase and we can maintain them as needed.

Thanks also for sharing kotlin-react-function project, I’ll have a look at it later.

1reaction
sgrishchenkocommented, Oct 19, 2021

@francos you absolutely right, there is such a problem now, but this problem is present for each component in current DSL implementation: there is not way to set all props for component safely. We, maintainers, are thinking about solution for it, but we want to provide general solution. I think it does not fare to make wrapper for Router more complex and to add a lot of boilerplate code there because of DSL problems.

At the same time we cant provide solution right now. Probable solution is compiler plugin, but there is not appropriate API for compiler plugin in Legacy compiler and we have to provide compatibility for both IR and Legacy compilers until IR compilers is stable.

As temporary solution I can offer you to check this project, may be it will help you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Important changes (deprecations) coming in Power Apps and ...
"Deprecated" means we intend to remove the feature or capability from a future release. The feature or capability will continue to work and...
Read more >
1.14.0 (July 7, 2020) - Envoy Proxy
A mapping of extension names is available in the deprecated documentation. ... deprecated documentation. thrift_proxy: added router filter stats to docs.
Read more >
RFC 5095: Deprecation of Type 0 Routing Headers in IPv6
The purpose of this document is to deprecate a feature of IPv6 that has been shown to have undesirable security implications.
Read more >
Deprecated API Migration Guide - Kubernetes
When APIs evolve, the old API is deprecated and eventually removed. This page contains information you need to know when migrating fromĀ ...
Read more >
Private Network Access update: Introducing a deprecation trial
Deprecation trials allow Chrome to deprecate certain web features and prevent websites from forming new dependencies on them, while at the sameĀ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found