feature: Provide an initialization hook for when the VM/view is going to be added to the stack/pushed
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- desktop-dev, mobile-dev
Research direction
Start by tracing the Sextant navigation path where a view or view model is added to the stack, then compare its existing WhenActivated and OnAppearing lifecycle behavior. Define the initialization hook at the stack-insertion point and verify that it runs before display while preserving the existing repeated lifecycle behavior.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
It's related to usability and improving of lifecycle.
WhenActivatedhappens too late on the VM/View cycle to start performing operations, such as loading data at VM level, setting up bindings in the view. The order of execution can be seen here:
ViewModel Constructor
View Constructor: 691 milliseconds
View OnAppearing: 1172 milliseconds
ViewModel WhenActivated: 1180 milliseconds
View WhenActivated: 1192 milliseconds
- Due to the late
WhenActivatedexecution as stated above, for my case I exposed aViewModelDidBind, which is a simplethis.WhenAnyValue(v => v.ViewModel)exposed on my view base, so there I can start invoking commands, earlier. It does execute only once, when the viewmodel is set on that view instance, that differs from theOnAppearingand theWhenActivatedcause both will be executed every time the view/viewmodel gets displayed. TheViewModelDidBindworks for my purpose of starting things earlier in the flow (gets executed right after the view constructor) as follows:
View ViewModelDidBind: 705 milliseconds
Describe the solution you'd like
For performing operations/bindings I'd say I could start them right away when the view/viewmodel is added to the stack, that is a good earlier moment to setup things.
Describe alternatives you've considered
Describe suggestions on how to achieve the feature
What I can think right away is to expose a (potentially new) interface on Sextant and then to call it accordingly when adding that into the stack, and then let the view/viewmodel that's interested on it to implement that interface that would have that new "hook". Knowing it's being "initialized" it could perform the needed operations accordingly.
Additional context
- Dominant language
- C#
- Stars
- 160
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reactiveui/Sextant
-
支持Avalonia 12版本Open
Difficulty 4/5 3-5 days Newbie friendliness 22/100
reactiveui/Sextant#965 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 32/100
reactiveui/Sextant#769 ·
-
Dependency DashboardOpen
Difficulty 4/5 3-5 days Newbie friendliness 20/100
reactiveui/Sextant#754 ·
-
feature request
Difficulty 5/5 Over a week Newbie friendliness 25/100
reactiveui/Sextant#150 · 4 comments ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
reactiveui/Sextant#136 · 4 comments ·
All issues in reactiveui/Sextant
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Facepunch/sbox-public#12456 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
mcneel/rhino.inside-revit#1736 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
reactiveui/Primitives#254 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Kyrodan/KeeAnywhere#510 ·
-
area-Tools-ILLink untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day