Incorrect schema definition for "preload"

Created on 18 July 2023, over 1 year ago
Updated 7 August 2023, over 1 year ago

Problem/Motivation

Currently, the schema entry for "preload", looks as follows:

        preload:
          type: sequence
          label: 'Preload'
          sequence:
            - type: integer

First, I thought we need to simply remove the " - ". But instead, we need a mapping here, as there only can be 2 entries for the array here, see https://photoswipe.com/options/#preload.

Steps to reproduce

Proposed resolution

Use mapping instead.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: works as designed

Version

5.0

Component

Code

Created by

🇩🇪Germany Grevil

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

Comments & Activities

  • Issue created by @Grevil
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    11 pass, 2 fail
  • @grevil opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇩🇪Germany Grevil

    Done, please review! We should also cherry-pick this in 4.x!

    This is how "preload" looked before:

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    15 pass
  • 🇩🇪Germany Anybody Porta Westfalica

    I'm wondering why config inspector did not complain... but perhaps it wasn't possible to compare due to the specific case...

    Did you test the update hook? That's the dangerous part...

  • Status changed to Needs work over 1 year ago
  • 🇩🇪Germany Grevil

    Forgot to clear old keys.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    15 pass
  • Status changed to Needs review over 1 year ago
  • 🇩🇪Germany Grevil

    Ok, works as expected now! This is the new output after running the update hook:

    \Drupal::configFactory()->getEditable(...)->get(...) array (2)
    ⇄amountBefore => integer 1
    ⇄amountAfter => integer 1
    
  • Status changed to Needs work over 1 year ago
  • 🇩🇪Germany Grevil

    Actually, since we are using the js spread operator in 5.x we should check how the spread operator handles the array first, before commiting this.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    15 pass
  • 🇩🇪Germany Grevil

    Yep, thought so... preload is now a js object instead of an array, probably breaking its functionality.

  • Status changed to Closed: won't fix over 1 year ago
  • 🇩🇪Germany Grevil

    Well, I guess, we just close it as "won't fix" then.

  • Status changed to Active over 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica

    @Grevil: I'll reopen this, so we don't forget to talk about this. I don't get it here... ;)
    We can of cours decide to close it then.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Finally:
    The schema is correct as - is, without any change. It just allows unlimited entries, while only two are allowed.

    The proposed MR would make it an object, which would be even worse.
    The alternative fix would have been to explicitly save the two values separately and turn them into an array in PHP or JS, but it should be OK to just keep it this way.

Production build 0.71.5 2024