Skip to content

Comments

Fix issue where activity is null#1439

Merged
freekmurze merged 4 commits intospatie:mainfrom
rojtjo:fix/prevent-null-activity
Jan 31, 2026
Merged

Fix issue where activity is null#1439
freekmurze merged 4 commits intospatie:mainfrom
rojtjo:fix/prevent-null-activity

Conversation

@rojtjo
Copy link
Contributor

@rojtjo rojtjo commented Jan 21, 2026

Currently when using the facade it always returns the same PendingActivityLog object because facade instances are cached by default. This cuases the following issues:

  • The $activity property is set to null after calling the log method.
    This causes an issue when starting the chain using the event() or causedByAnonymous() methods as they expect the property to be set
  • The $log_name property is not set on the activity for consecutive calls

While disabling the caching of the facade already fixes both of these issues, I also included df95425 to ensure the activity is always accessed the same way.

An alternative fix would be to always return a new instance of ActivityLogger from the PendingActivityLog class.

Let me know if you prefer the alternative fix instead!

@freekmurze freekmurze merged commit c0cbe8a into spatie:main Jan 31, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants