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

Fix init of TC module #3511

Merged
merged 4 commits into from
Jan 29, 2025
Merged

Fix init of TC module #3511

merged 4 commits into from
Jan 29, 2025

Conversation

dpanta94
Copy link
Member

@dpanta94 dpanta94 commented Jan 29, 2025

🎫 Ticket

ETP-972

🗒️ Description

The commerce module should be initialized as early as possible in order for registrations that happen in the parent's construct to take place as early as possible as well.

This was a singleton already, so nothing should break by registering it asap.

🎥 Artifacts

No point for artifact really. The Module would be initialized whenever it was needed for the first time. Making calls to Tribe__Tickets__Tickets::modules() unstable and completely dependent on timing.

✔️ Checklist

  • Ran npm run changelog to add changelog file(s). More info here
  • Code is covered by NEW wpunit or integration tests.
  • Code is covered by EXISTING wpunit or integration tests.
  • Are all the required tests passing?
  • Automated code review comments are addressed.
  • Have you added Artifacts?
  • Check the base branch for your PR.
  • Add your PR to the project board for the release.

@dpanta94 dpanta94 added the code review Status: requires a code review. label Jan 29, 2025
@dpanta94 dpanta94 self-assigned this Jan 29, 2025
@dpanta94 dpanta94 requested a review from a team January 29, 2025 16:33
Comment on lines 63 to +65
$this->container->singleton( Module::class );
// We need to init for the registration as a module to take place early.
$this->container->get( Module::class );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->container->singleton( Module::class );
// We need to init for the registration as a module to take place early.
$this->container->get( Module::class );
// We need to init for the registration as a module to take place early.
$this->container->singleton( Module::class, Module::class );

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ? if the the 2 first arguments are the same this is completely unnecessary. The singleton method already does that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing as 2nd param loads it immediately.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, i dont see it :(

@rafsuntaskin
Copy link
Contributor

Should the hook to load the module should still be relevant after this change?

@dpanta94 dpanta94 merged commit b1635eb into bucket/waitlists Jan 29, 2025
20 of 21 checks passed
@dpanta94 dpanta94 deleted the fix/init-of-tc-module branch January 29, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code review Status: requires a code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants