V8-archive: Item.remove action hook isn't returning data

Created on 21 Mar 2019  路  6Comments  路  Source: directus/v8-archive

Bug Report

item.delete.[colection] action hook doesn't return $data parameter. Instead it returns an ID for a row that doesn't exists anymore in case of :after.

Steps to Reproduce

  1. Create any action hook
  2. var_dump the first parameter
  3. See only the ID of the item

Expected Behavior

Return full data from the item you're trying to delete

Actual Behavior

Returning only ID from an item that in some cases doesn't exist.

Other Context & Screenshots

This was the function for the action hook i used when testing:

'item.create.table' => function($data){ var_dump($data); },

Technical Details

  • Device: Desktop PC
  • OS: Windows 10 Pro
  • Browser: Chrome 72.0.3626.121 64bit
  • Directus App: 7.0.19
  • Directus API: 2.0.19
  • Install Method: Download zip and extract.
bug

Most helpful comment

@Mozz4rt

This issue is resolved with #882. I just added the extra parameter along with ID. So the other user's who used this hook earlier, they will not be affected by this change.

All 6 comments

Thank you for the report @Mozz4rt 馃檪 @hemratna or @bjgajjar will be having a look at this issue soon.

@Mozz4rt

We developed the explicit code like the delete hook will have an ID only instead of the object.

May I know the usecase of this functionality?

We have to consider this as a feature request instead of a bug. Let me know your thoughts @benhaynes

I'm not sure what is standard, but I could see why it would be nice to have the item info in the hook (eg: so you could send an email/notification saying XXXXX item was deleted. Any thoughts @rijkvanzanten ?

@benhaynes Funny enough, that's exactly what I was hoping to achieve.

@bjgajjar the problem with returning the id and why i see It as a bug is that :after delete you can't do much with the returned id since it's no longer in the database, the expected would be an obj copy of the deleted item for further use..

@Mozz4rt

This issue is resolved with #882. I just added the extra parameter along with ID. So the other user's who used this hook earlier, they will not be affected by this change.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HashemKhalifa picture HashemKhalifa  路  3Comments

jwkellyiii picture jwkellyiii  路  3Comments

benhaynes picture benhaynes  路  4Comments

gitlabisbetterthangithub picture gitlabisbetterthangithub  路  3Comments

Nitwel picture Nitwel  路  3Comments