Problem/Motivation

#3479245: JS Warning About Not Enough Slides introduced many problems:
* PHP warning because of sometimes `count()` on NULL.
* Despite the permissions check, this patch doesn't set cache contexts, so the warning message will be cached and shown to anonymous visitors.
* I'm unsure why a content editor needs to be told that a widget is choosing option B instead of option A. This is just confusion inducing.
* IMO the JS console message is a _good_ thing to help debug what's going on. IMO there's no need to remove it in the first place, though I understand why others might disagree.

Steps to reproduce

Create content with only one or zero items in the Swiper.

Proposed resolution

Adjust `template_preprocess_swiper_formatter()` to fix problems 1–3. We can leave 4 as-is.

Remaining tasks

review and commit

User interface changes

no more warning message about only 1 item

API changes

none

Data model changes

none

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dalin created an issue. See original summary.

dalin’s picture

dalin changed the visibility of the branch 3567577-fix-uxjscachingphp-issues to hidden.

dalin’s picture

Assigned: dalin » Unassigned
Status: Active » Needs review
dalin’s picture

Issue summary: View changes
bbu23’s picture

Status: Needs review » Active

Hi,

Thanks for reporting this major issue.
Indeed, there's no point in seeing a message about the choice.

I don't see an open merge request, so I'm adjusting the status back to Active until there's something available for review.

dalin’s picture

Status: Active » Needs review

The multi-step process always throws me off. There's now an MR.

bbu23’s picture

No worries, thank you for taking the time to provide the MR.
We will review it as soon as possible.

  • bbu23 committed c0bdaadf on 2.1.x authored by dalin
    fix: #3567577 Resolve UX/PHP/caching issues caused by warning message to...

  • bbu23 committed 0e64d02d on 2.0.x authored by dalin
    fix: #3567577 Resolve UX/PHP/caching issues caused by warning message to...
bbu23’s picture

Status: Needs review » Fixed

Backported to 2.0.x as well, thanks.
Will be available in 2.0.3 and 2.1.0.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

dalin’s picture

@bbu23
Could you give contribution credit for this?

bbu23’s picture

@dalin Of course, but I checked and it seems that you already have credit for this, is it not showing to you? 🤔

dalin’s picture

@bbu23
You are correct. Sorry, the SSO system across multiple domains tripped me up.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.