sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Batch actions operate on unselected objects #6430

Closed Kolyunya closed 3 years ago

Kolyunya commented 3 years ago

Environment

Sonata packages

sonata-project/admin-bundle              3.76.0 = 3.76.0 The missing Symfony Admin Generator
sonata-project/block-bundle              4.3.0  = 4.3.0  Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  = 2.0.1  Cache library
sonata-project/doctrine-extensions       1.9.1  = 1.9.1  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.23.0 = 3.23.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter                  2.3.0  = 2.3.0  Lightweight Exporter library
sonata-project/form-extensions           1.6.0  = 1.6.0  Symfony form extensions
sonata-project/twig-extensions           1.4.1  = 1.4.1  Sonata twig extensions

Symfony packages

symfony/asset                      v4.4.13 ! v4.4.14 Symfony Asset Component
symfony/cache                      v4.4.13 ! v4.4.14 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts            v2.2.0  = v2.2.0  Generic abstractions related to caching
symfony/config                     v4.4.13 ! v4.4.14 Symfony Config Component
symfony/console                    v4.4.13 ! v4.4.14 Symfony Console Component
symfony/debug                      v4.4.13 ! v4.4.14 Symfony Debug Component
symfony/dependency-injection       v4.4.13 ! v4.4.14 Symfony DependencyInjection Component
symfony/doctrine-bridge            v4.4.13 ! v4.4.14 Symfony Doctrine Bridge
symfony/dotenv                     v4.4.13 ! v4.4.14 Registers environment variables from a .env file
symfony/error-handler              v4.4.13 ! v4.4.14 Symfony ErrorHandler Component
symfony/event-dispatcher           v4.4.13 ! v4.4.14 Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.9  ~ v2.2.0  Generic abstractions related to dispatching event
symfony/expression-language        v4.4.13 ! v4.4.14 Symfony ExpressionLanguage Component
symfony/filesystem                 v4.4.13 ! v4.4.14 Symfony Filesystem Component
symfony/finder                     v4.4.13 ! v4.4.14 Symfony Finder Component
symfony/flex                       v1.9.4  = v1.9.4  Composer plugin for Symfony
symfony/form                       v4.4.13 ! v4.4.14 Symfony Form Component
symfony/framework-bundle           v4.4.13 ! v4.4.14 Symfony FrameworkBundle
symfony/http-foundation            v4.4.13 ! v4.4.14 Symfony HttpFoundation Component
symfony/http-kernel                v4.4.13 ! v4.4.14 Symfony HttpKernel Component
symfony/inflector                  v4.4.13 ! v4.4.14 Symfony Inflector Component
symfony/intl                       v4.4.13 ! v4.4.14 A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/maker-bundle               v1.21.1 = v1.21.1 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/mime                       v4.4.13 ! v4.4.14 A library to manipulate MIME messages
symfony/options-resolver           v4.4.13 ! v4.4.14 Symfony OptionsResolver Component
symfony/polyfill-intl-grapheme     v1.18.1 = v1.18.1 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu          v1.18.1 = v1.18.1 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.18.1 = v1.18.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.18.1 = v1.18.1 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.18.1 = v1.18.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.18.1 = v1.18.1 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73             v1.18.1 = v1.18.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80             v1.18.1 = v1.18.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process                    v4.4.13 ! v4.4.14 Symfony Process Component
symfony/property-access            v4.4.13 ! v4.4.14 Symfony PropertyAccess Component
symfony/routing                    v4.4.13 ! v4.4.14 Symfony Routing Component
symfony/security-acl               v3.1.0  = v3.1.0  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v4.4.13 ! v4.4.14 Symfony SecurityBundle
symfony/security-core              v4.4.13 ! v4.4.14 Symfony Security Component - Core Library
symfony/security-csrf              v4.4.13 ! v4.4.14 Symfony Security Component - CSRF Library
symfony/security-guard             v4.4.13 ! v4.4.14 Symfony Security Component - Guard
symfony/security-http              v4.4.13 ! v4.4.14 Symfony Security Component - HTTP Integration
symfony/serializer                 v4.4.13 ! v4.4.14 Symfony Serializer Component
symfony/service-contracts          v2.2.0  = v2.2.0  Generic abstractions related to writing services
symfony/stopwatch                  v4.4.13 ! v4.4.14 Symfony Stopwatch Component
symfony/string                     v5.1.5  ! v5.1.6  Symfony String component
symfony/translation                v4.4.13 ! v4.4.14 Symfony Translation Component
symfony/translation-contracts      v2.2.0  = v2.2.0  Generic abstractions related to translation
symfony/twig-bridge                v4.4.13 ! v4.4.14 Symfony Twig Bridge
symfony/twig-bundle                v4.4.13 ! v4.4.14 Symfony TwigBundle
symfony/validator                  v4.4.13 ! v4.4.14 Symfony Validator Component
symfony/var-dumper                 v4.4.13 ! v4.4.14 Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v4.4.13 ! v4.4.14 A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-profiler-bundle        v4.4.13 ! v4.4.14 Symfony WebProfilerBundle
symfony/yaml                       v4.4.13 ! v4.4.14 Symfony Yaml Component

PHP version

PHP 7.4.10 (cli) (built: Sep  3 2020 19:33:10) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Batch actions operate on unselected objects

I was implementing a list of files, affected by a batch action, when I realized I found some really nasty bug. For some reason my list was showing more objects than I actually was selecting. After a quick debugging I realize it was caused by coming back from the confirmation page to the list page.

Steps to reproduce

  1. Open a list page.
  2. Select 1 object.
  3. Use batch delete action.
  4. Return back from the confirmation page to the list page via the browser back button. Seems like using the back button on the page, rendered by Sonata does not reproduce the issue.
  5. Previously selected object will not be shown as selected.
  6. Select another object
  7. Use batch delete action.
  8. Confirm.
  9. Both objects will be deleted.

Expected results

When you return from the confirmation page either previously selected object is shown as selected or it is not implicitly selected and affected by a batch action.

Actual results

Previously selected object is neither shown as selected while it is being processed.

kirya-dev commented 3 years ago

image Bug really happens!

Problem related with library iCheck.

VincentLanglet commented 3 years ago

Is it something to report to iCheck or something which can/should be fixed in SonataAdmin code ?

kirya-dev commented 3 years ago

Author says that actual result: all checkboxes must be unset. For ex: https://stackoverflow.com/questions/37933043/reset-checkbox-checked-state-go-back-from-history

VincentLanglet commented 3 years ago

Author says that actual result: all checkboxes must be unset. For ex: https://stackoverflow.com/questions/37933043/reset-checkbox-checked-state-go-back-from-history

Do you want to work on a fix then ?