Problem/Motivation

When multiple Splide carousels are rendered on the same page, one instance with
a single item can affect the configuration of the other instances.

The expected behavior is that a single-item carousel is softly unsplided without
changing the behavior of the other Splide carousels on the page.

The actual behavior is that when one instance has count === 1, other instances
may inherit reset options unintentionally and end up with fade/unsplide-related
behavior. In our case this was visible on the homepage, where multiple Views
were rendered as independent Splide carousels. If only one of them had a single
result, the others could also be affected.

The issue appears to be in the Drupal integration loader, not in the upstream
Splide library itself. In js/src/splide.load.js, per-instance options are built
starting from shared objects such as CONFIG.extras and breakpoints. When resets
are applied for count === 1, the shared state is reused by later instances on
the same page.

Affected version tested: drupal/splide 2.0.13.

Steps to reproduce

1. Create a page with multiple Splide instances.
2. Make sure one carousel has only one item.
3. Make sure at least one other carousel on the same page has multiple items.
4. Load the page.
5. Inspect the rendered behavior and classes of the other carousels.
6. Notice that other instances may also inherit fade/unsplide-related behavior,
even though they should remain normal carousels.

As sad before, in our case this happened on one page with multiple Views displays rendered
as separate Splide carousels.

Proposed resolution

Clone the mutable configuration objects per instance before applying resets.

In particular:
- clone breakpoints before modifying them
- clone CONFIG.extras before merging reset values
- keep all reset mutations isolated to the current carousel instance

This prevents one single-item instance from mutating state later reused by other
instances on the same page.

A local patch has been tested successfully with this approach.

Remaining tasks

- Review and test the attached patch against the current 2.x branch.
- Confirm whether the minified asset should be rebuilt as part of the fix.
- Add a regression test if the project has a suitable test coverage path for
multi-instance frontend behavior.

User interface changes

No intended UI changes.

This fix restores the expected behavior so that each Splide carousel behaves
independently. A single-item carousel should no longer alter the presentation or
transition mode of other carousels on the same page.

API changes

None.

No public API or configuration schema changes are required.

Data model changes

None.

Comments

10thdoctor created an issue.