Skip to content

Page transitions: avoid unsafe inline script re-execution after AJAX nav #369

@georgeolaru

Description

@georgeolaru

Problem

After AJAX navigation (Barba), inline body scripts are re-executed too broadly. This can re-run non-data/module scripts and trigger runtime errors (for example: Identifier 'a' has already been declared from the wp-emoji module script).

Repro

  1. Enable Page Transitions
  2. Navigate Home -> Work -> single -> Work via AJAX
  3. Observe console/runtime errors during transition lifecycle

Expected

Only safe data/config inline scripts should be re-applied, and module/json scripts should be ignored.

Proposed fix

  • Restrict inline script syncing to safe patterns (*-js-extra, FacetWP JSON assignment)
  • Skip module and non-JS script types
  • Preserve inline script id/type when re-injecting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions