Skip to content

When defaultSwap is none history doesn't work #3652

@yousefgitter

Description

@yousefgitter

HTMX 4

When the following option is set like so:

htmx.config.defaultSwap = "none";

The solution I've got to work is the following.

	document.addEventListener('htmx:config:request', (evt) => {
		const ctx = evt.detail.ctx;
		if (ctx.request.headers['HX-History-Restore-Request'] === 'true') {
		}else{
			ctx.swap = 'none';
		}
	});

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