File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -122,9 +122,16 @@ Markdown(markdownState)
122
122
123
123
### Parse Markdown in VM
124
124
125
+ > [ !NOTE]
126
+ > This approach is also advised if you want to retain scroll position even when navigating away
127
+ > See: https://github.com/mikepenz/multiplatform-markdown-renderer/issues/374
128
+ > Retaining state in the VM ensures parsing will not have to be done again, and the component can be
129
+ > immediately filled.
130
+
125
131
``` kotlin
126
132
// In the VM setup the flow to parse the markdown
127
133
val markdownFlow = parseMarkdownFlow(" # Markdown" )
134
+ .stateIn(lifecycleScope, SharingStarted .Eagerly , State .Loading ())
128
135
129
136
// In the Composable use the flow
130
137
val state by markdownFlow.collectAsStateWithLifecycle(State .Loading ())
You can’t perform that action at this time.
0 commit comments