You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ description: frictionless state management
6
6
7
7
> Web application development is about **defining**, **changing** and **consuming state** to produce a user experience. Overmind aims for a developer experience where that is all you focus on, reducing the orchestration of state management to a minimum. Making you a **happier** and more **productive** developer!
@@ -6,10 +6,6 @@ Using Graphql with Overmind gives you the following benefits:
6
6
***Cache:** You integrate the data from Graphql with your existing state, allowing you to control when new data is needed
7
7
***Optimistic updates:** With the data integrated with your Overmind state you can also optimistically update that state before running a mutation query
8
8
9
-
{% hint style="info" %}
10
-
The Graphql package does not support **subscriptions** currently
11
-
{% endhint %}
12
-
13
9
## Get up and running
14
10
15
11
Install the separate package:
@@ -20,7 +16,7 @@ npm install overmind-graphql
20
16
21
17
### Initial state
22
18
23
-
The Graphql package is a _configuration factory_. That means you need some existing configuration before going:
19
+
The Graphql package is an _effect_. Though since we are operating on state, let us prepare some:
You define **queries** and **mutations**as part of the second argument to the factory, with what **endpoint** you want to connect to. These queriesand mutations are converted into Overmind effects that you can call from your actions.
137
+
You define **queries,****mutations**and **subscriptions**with the effect. That means you can have multiple effects holding different queries and even endpoints. The endpoints are defined when you initialize the effect. This allows you to dynamically create the endpoints based on state, and also pass state related to requests to the endpoints. The queries, mutations and subscriptions are converted into Overmind effects that you can call from your actions.
99
138
100
139
## Query
101
140
102
141
To call a query you will typically use an action. Let us create an action that uses our **posts** query.
@@ -193,58 +239,55 @@ There are two points of options in the Graphql factory. The **headers** and the
193
239
The headers option is a function which receives the state of the application. That means you can produce request headers dynamically. This can be useful related to authentciation.
Copy file name to clipboardExpand all lines: api-1/addmutationlistener.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# addMutationListener
2
2
3
-
It is possible to listen to all mutations performed in Overmind. This allows you to create special effects based on mutations within a certain domain of your app, or whatever else you come up with. Note that this method triggers before the mutation occurs, you might rather want to use **addFlushListener** to be notified about batched changes, like the components does.
3
+
It is possible to listen to all mutations performed in Overmind. This allows you to create special effects based on mutations within a certain domain of your app, or whatever else you come up with. Note that this method triggers right after any mutation occurs, you might rather want to use **addFlushListener** to be notified about batched changes, like the components does.
By default Overmind will create state paths using `.` as delimiter. This is used to give each state value an address and is used with the devtools. If any state keys uses `.` you will get weird behaviour in the devtools. You can now change this delimiter to a safe value, typically `' '` or `'|'` :
76
+
77
+
```typescript
78
+
const overmind =createOvermind(config, {
79
+
delimiter: '.'
80
+
})
81
+
```
82
+
73
83
## events
74
84
75
85
Overmind emits events during execution of actions and similar. It can be beneficial to listen to these events for analytics or maybe you want to create a custom debugging experience. The following events can be listened to by adding a listener to the eventHub:
0 commit comments