Skip to content

Replace visits get converted to advance #164

@realprabs

Description

@realprabs

In https://github.com/hotwired/hotwire-native-android/blob/8ba14aea1c19e2a3a9458dc33320ed617a5a9d40/core/src/main/kotlin/dev/hotwire/core/turbo/session/Session.kt#L625C5-L645C6

private fun visitLocation(visit: Visit) {
        val restorationIdentifier = when (visit.options.action) {
            VisitAction.RESTORE -> restorationIdentifiers[visit.destinationIdentifier] ?: ""
            VisitAction.ADVANCE -> ""
            else -> ""
        }

        val options = when (restorationIdentifier) {
            "" -> visit.options.copy(action = VisitAction.ADVANCE)
            else -> visit.options
        }

        logEvent(
            "visitLocation",
            "location" to visit.location,
            "options" to options,
            "restorationIdentifier" to restorationIdentifier
        )

        webView.visitLocation(visit.location, options, restorationIdentifier)
}

If the visit is replace and restorationIdentifier does not exist, replace gets converted into advance. Can we not do that?

This prevents us from using history state (history.replaceState specifically) in https://github.com/realprabs/hotwire-native-bolt.

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