Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Not hide and not redirect after delete record #5718

Open
zivarg opened this issue Nov 19, 2024 · 3 comments
Open

[Bug] Not hide and not redirect after delete record #5718

zivarg opened this issue Nov 19, 2024 · 3 comments
Assignees

Comments

@zivarg
Copy link

zivarg commented Nov 19, 2024

Bug report

What I did

After deleting a record, the modal window (dtr-modal) does not close and does not redirect to the list.

What I expected to happen

Close the window or redirect to the previous tab.

What happened

A window with the deleted record data is displayed after the record is deleted.

What I've already tried to fix it

I think the modal window can be fixed in delete.blade.php by adding $('.modal').modal('hide');

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there?

Yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

8.2.12

PHP EXTENSIONS:

Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, SPL, pcre, random, readline, Reflection, session, standard, mysqlnd, tokenizer, zlib, libxml, dom, PDO, bz2, SimpleXML, xml, xmlreader, xmlwriter, openssl, curl, fileinfo, gettext, mbstring, exif, mysqli, pdo_mysql, pdo_sqlite, Phar, ftp

LARAVEL VERSION:

11.15.0.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.3.4
backpack/crud: 6.7.41
backpack/generators: v4.0.5
backpack/pro: 2.2.24
backpack/theme-tabler: 1.2.10

@zivarg zivarg added the triage label Nov 19, 2024
Copy link

welcome bot commented Nov 19, 2024

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use GitHub Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

  • Bug Reports, Feature Requests - GitHub Issues (here);
  • Quick help (How do I do X) - Gitter Chatroom;
  • Long questions (I have done X and Y and it won't do Z wtf) - Stackoverflow, using the backpack-for-laravel tag;
  • Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

Copy link

Thank you for reporting this issue. Based on the information provided, it appears you're experiencing a bug related to the delete functionality in Backpack CRUD. Let me address this based on the available knowledge sources.

This issue seems to be a known bug that has been reported and discussed in several GitHub issues for Backpack. The behavior you're experiencing - where the modal window doesn't close and doesn't redirect after deleting a record - is consistent with what others have reported.

In a GitHub issue discussing a similar problem, it was noted that after deleting an entry from the preview view, the system doesn't redirect back to the list view as expected. Instead, it leaves the user on a deleted view, which results in a 404 error if refreshed.

The development team has acknowledged this as an issue. In the same discussion, a Backpack team member commented:

Yeah... we should probably do something about this. But let's do it in v6 - the behaviour changes, so it's "kind of" a breaking change. I've tagged this appropriately, and moved to the v6 project.

Your suggestion to modify the delete.blade.php file to include $('.modal').modal('hide'); is on the right track. In fact, in an older version of the delete functionality, this line was indeed present in the AJAX success callback:

// Hide the modal, if any
$('.modal').modal('hide');

However, it's important to note that modifying core Backpack files directly is not recommended, as these changes may be overwritten during updates.

As for a solution, since you're using Backpack CRUD version 6.7.41, which is part of the v6 series where this issue was supposed to be addressed, it seems the fix hasn't been fully implemented or there might be some regression.

For now, you might want to consider:

  1. Reporting this specific issue on the Backpack GitHub repository, providing details about your setup and steps to reproduce.

  2. As a temporary workaround, you could override the delete button functionality in your specific CRUD controller to handle the redirection after successful deletion.

  3. Keep an eye on future Backpack updates, as this issue might be resolved in upcoming releases.

Remember, modifying core package files is not recommended. If you need to customize this behavior, it's better to extend or override the functionality in your own code.

Relevant sources:

Github Issue (closed): [Bug] Delete on preview page don't redirect to list
Github Issue (closed): [Bug]
Github Issue (open): [Bug] show view delete button keep entry open after deletion.
Github Issue (closed): Event cancels delete but backpack reports item deleted
Github Issue (closed): [Bug] visibleInModal not working anymore
Github Issue (closed): [Bug] Upgrade BackPack v5 to v6
Github Issue (closed): [Bug] Category relationship
Github Issue (closed): [Feature Request] Implement a CanBeDeletedInterface
Is there a way to optimize the delete function script ?
Github Issue (closed): [Feature] hide actions buttons for specific row in backpack list operations
Github Issue (closed): addColumn(visibleInModal=>false) after addColumn(visibleInTable => false) : Error in modal view.
Github Issue (closed): [4.0][Known Bug] Modals won't show correctly in v4
Github Issue (closed): [Bug] ListOperation modal no longer showing when ellipsis is clicked
Refactor delete

@karandatwani92
Copy link
Contributor

Hey @zivarg

Thanks for reporting the BUG. I have assigned my colleague to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants