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

OrderLine ID is undefined on OrderLineEvent deleted event #2574

Closed
lzzfnc opened this issue Dec 11, 2023 · 4 comments
Closed

OrderLine ID is undefined on OrderLineEvent deleted event #2574

lzzfnc opened this issue Dec 11, 2023 · 4 comments
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@lzzfnc
Copy link
Contributor

lzzfnc commented Dec 11, 2023

Describe the bug
Hello! I'm writing a plugin to do some operations with the id of an OrderLine once it's removed from an order. I'm using the EventBus to filter the events and get only the ones where event.type === 'deleted'. In the subscribe function however, the orderLine id is undefined. Is this the expected behaviour or I'm missing something?

To Reproduce
Steps to reproduce the behavior:

  1. Use the event bus to subscribe to OrderLineEvents
  2. Log OrderLines
  3. When event.type is created or updated the id is present
  4. When event.type is deleted the id is undefined

Expected behavior
To be able to access the id before the cancellation of an OrderLine

Environment (please complete the following information):

  • @vendure/core version: 2.1.3
  • Nodejs version 18
  • Database (mysql/postgres etc): postgres
@lzzfnc lzzfnc added the type: bug 🐛 Something isn't working label Dec 11, 2023
@lzzfnc lzzfnc changed the title OrderLine ID is undefined on OrderLineEvent 'deleted` event OrderLine ID is undefined on OrderLineEvent deleted` event Dec 11, 2023
@lzzfnc lzzfnc changed the title OrderLine ID is undefined on OrderLineEvent deleted` event OrderLine ID is undefined on OrderLineEvent deleted event Dec 11, 2023
@michaelbromley
Copy link
Member

Hi, this is a peculiarity with TypeORM that seems to mutate the object upon calling the .remove() method on an entity. It was generally addressed for other events with this commit: 265bb15, but I overlooked the OrderLineEvent at the time.

@lzzfnc
Copy link
Contributor Author

lzzfnc commented Dec 11, 2023

I see, thanks! Do you want me to send a PR for that?

@michaelbromley
Copy link
Member

michaelbromley commented Dec 11, 2023

I'm in the process of fixing, but thanks for the offer. :)

When I tried to fix in the same way as the linked commit, it revealed an underlying issue that also needs fixing at the same time.

@lzzfnc
Copy link
Contributor Author

lzzfnc commented Dec 11, 2023

Super, thanks a lot then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants