OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add links and formatting to 'dev: state management' doc page
Christophe Bliardab36d770c41d
diff --git a/docs/development/concepts/state-management/README.md b/docs/development/concepts/state-management/README.mdindex 77d9c9a3fc8..50b13ef965a 100644--- a/docs/development/concepts/state-management/README.md+++ b/docs/development/concepts/state-management/README.md@@ -15,17 +15,17 @@ State management in complex frontend applications is a topic that has been heavi*State management in OpenProject frontend...*-- is mainly controlled by `RxJs` and the reactivestates library-- `State` and `InputState` are mostly syntactic sugar over RXJS `Subject` and `BehaviorSubject`+- is mainly controlled by `RxJs` and the [reactivestates](https://github.com/ReactiveStates/reactivestates) library+- `State` and `InputState` are mostly syntactic sugar over RxJS `Subject` and `BehaviorSubject`- States are used to hold and cache values with their values and non-values being observable## InputState-An `InputState` object is a wrapper around RXJS Behaviorsubject. It provides some syntactic sugar over it to inspect values and provide helpers to observe streams and fill in the underlying `Subject`.+An `InputState` object is a wrapper around RxJS [`BehaviorSubject`](https://rxjs.dev/api/index/class/BehaviorSubject). It provides some syntactic sugar over it to inspect values and provide helpers to observe streams and fill in the underlying `Subject`.-To create an InputState, you call `new InputState<Type>(initialValue:Type|undefined)` or use the helper method `input<Type>(initialValue?:Type)` which will fall back to the undefined value. You will then be able to inspect its value and contents.+To create an `InputState`, call `new InputState<Type>(initialValue:Type|undefined)` or use the helper method `input<Type>(initialValue?:Type)` which will fall back to the undefined value. You will then be able to inspect its value and contents.```typescript// An initially empty state@@ -76,7 +76,7 @@ state.clearAndPutFromPromise(Promise.resolve('overridden value'));-You can get an RXJS observable to the value stream with `state.values$()`:+You can get an RxJS `Observable` to the value stream with `state.values$()`:```typescriptstate@@ -100,14 +100,14 @@ The `MultiInputState` is basically a map with a string key and an `InputState` a-To create a MultiInputState, you can use the helper method `multiInput<Type>()` . To get an InputState member of this map, use the following:+To create a `MultiInputState`, use the helper method `multiInput<Type>()` . To get an `InputState` member of this map, use the following:```typescriptexport type FooType = { id:number };const multi = multiInput<FooType>();const state = multi.get('my identifier');state.putValue({ id: 1234 });-+// Later onmulti.get('my identifier').value // { id: 1324}```@@ -161,4 +161,4 @@ This might then look like the following, with green color for added objects, and## Discussions- In contrast to a `Store` concept of redux, the States and state groups do not have any concept of data immutability. As a caller you will need to ensure that. In OpenProject, many of the states are in fact mutable due to historic reasons and the fact that complex class instances are passed around that cannot be easily shallow copied. This will need to be refactored in the future.-- As the reactivestates library was primarily developed for us, we may need to take over its code or move to a different state management concept altogether. The recent developments in `ngxs` look very promising.\ No newline at end of file+- As the reactivestates library was primarily developed for us, we may need to take over its code or move to a different state management concept altogether. The recent developments in `ngxs` look very promising.