Race condition with instance.options in splide.base.js results in incorrect merged options

Created on 25 June 2024, 5 months ago
Updated 11 July 2024, 4 months ago

Problem/Motivation

After updating from 2.0.7 to 2.0.8/2.0.9 some of my optionsets broke, and I tracked it down to this change in splide.base.js:

var opts = $.extend(instance.options, userOptions);

A breakpoint at instance.options shows an empty object, but printing it out using console.log shows that it's populated. There must be a race condition as this function is called while the instance is initialized.

(There are also still references to the var o = instance.options; variable which was removed).

Steps to reproduce

Set a breakpoint before the extend and inspect instance.options.

Proposed resolution

Clone the object instead of modifying the original, and get the instance options on use to ensure it's initialized.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States karlshea Minneapolis 🇺🇸

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024