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
+19-31Lines changed: 19 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,9 @@ Building your application with a single state tree is the most straight forward
33
33
Separate 3rd party APIs and logic not specific to your application by using **effects**. This will keep your application logic pure and without low level APIs cluttering your code.
When you build applications that perform many state changes things can get out of hand. In Overmind you can only perform state changes from **actions** and all changes are tracked by the development tool.
this.validationError='You need some numbers in your password'
143
135
}
@@ -148,11 +140,7 @@ class LoginForm() {
148
140
}
149
141
}
150
142
151
-
typeState= {
152
-
loginForm: LoginForm
153
-
}
154
-
155
-
exportconststate: State= {
143
+
exportconststate= {
156
144
loginForm:newLoginForm()
157
145
}
158
146
```
@@ -163,7 +151,7 @@ export const state: State = {
163
151
164
152
Bring in your application configuration of state, effects and actions. Create mocks for any effects. Take a snapshot of mutations performed in an action to ensure all intermediate states are met.
@@ -209,7 +193,7 @@ There are two points of options in the Graphql factory. The **headers** and the
209
193
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.
It is possible to generate all the typings for the queries and mutations. This is done by using the [APOLLO](https://www.apollographql.com/) project CLI. Install it with:
264
291
@@ -284,6 +311,10 @@ npm run schema
284
311
285
312
Apollo will look for queries defined with the **gql** template tag and automatically produce the typings. That means whenever you add, remove or update a query in your code you should run this script to update the typings. It also produces what is called **graphql-global-types**. These are types related to fields on your queries, which can be used in your state definition and/or actions.
286
313
314
+
{% hint style="info" %}
315
+
Note that initially you have to define your queries without types and after running the script you can start typing them to get typing in your app and ensure that your app does not break when you change the queries either in the client or on the server
316
+
{% endhint %}
317
+
287
318
## Optimize query
288
319
289
320
It is possible to transpile the queries from strings into code. This reduces the size of your bundle, though only noticeably if you have a lot of queries. This can be done with the [BABEL-PLUGIN-GRAPHQL-TAG](https://github.com/gajus/babel-plugin-graphql-tag).
For scalability you can define **namespaces** for multiple configurations. Read more about that in [Structuring the app](../guides-1/structuring-the-app.md)
243
+
For scalability you can define **namespaces** for multiple configurations. Read more about that in [Structuring the app](structuring-the-app.md)
0 commit comments