Repository navigation
feat(core)!: add safe View and ViewModel lifecycle helpers - #328
Merged
Merged
Conversation
- Log lifecycle exceptions and accept null Views. - Cover successful calls and exception handling in EditMode.
- Check Unity object liveness before lifecycle calls. - Cover destroyed Views across all safe overloads in EditMode.
- Skip null and destroyed Unity objects before initialization or disposal. - Log exceptions and continue batch initialization after individual failures.
- Use the IView receiver for deinitialization. - Reject destroyed Unity Views in both disposal overloads. - Share the disposal profiler marker.
- Use the same Unity liveness check for Views and ViewModels. - Keep concrete batch enumeration and log iterator failures.
- Reject destroyed Unity references in strict lifecycle calls. - Report both invalid initialization arguments and remove disposal profiler markers.
- Log cleanup failures after attempting destruction. - Cover component and GameObject destruction through both receiver types.
- Merge the destruction methods into the partial ViewExtensions type. - Preserve Unity script metadata and document explicit call migration.
- Merge destruction methods into partial ViewModelExtensions. - Preserve script metadata and document explicit call migration.
- Match the null handling of View destruction. - Verify all overloads and regenerate the API reference.
- Keep interface overloads and make whole-object ViewModel destruction void. - Preserve cleanup exceptions in regular calls and log them in safe calls. - Normalize destroyed GameObject results and update lifecycle tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
Replace explicit
MonoViewExtensionsandMonoViewModelExtensionscalls withViewExtensionsandViewModelExtensions, respectively. CallDeinitializeView()without an explicit type argument.Reinitialize,DeinitializeViewand bothDisposeViewoverloads reject destroyed Unity objects. Strict ViewModel initialization and disposal also reject destroyed Unity objects. Initialization reports two invalid arguments in anAggregateException. Use the corresponding*Safelymethods to skip missing objects. Destruction methods use interface overloads, andDestroyViewModelAndGameObjectnow returnsvoid.Why
Optional Views and lifecycle callbacks can require callers to wrap cleanup or reinitialization in exception handling.
What
Start with ViewExtensions.cs.
Verification
node scripts/check-package-files.mjspassed on the PR checkout.