Commit Graph

56 Commits

Author SHA1 Message Date
Géry Debongnie 895fe7c60f [REF] store: replace ConnectedComponent by useStore hook
Closes #304
2019-10-14 11:06:59 +02:00
Géry Debongnie 5382e824b1 [REF] owl: reorganize src code in sub files 2019-07-16 13:12:08 +02:00
Géry Debongnie 15a3f59744 [REF] owl: move some exported values around
This is a breaking change. Code using Observer, EventBus, Store or
ConnectedComponent need to update the way they import theses classes.

- Observer is now in owl.misc (so you can import it like this:
    const Observer = owl.misc.Observer;)
- EventBus is also now in owl.misc
- Store and ConnectedComponent are now together in store
2019-07-14 09:02:02 +02:00
Géry Debongnie 545ceefc3d [REF] store: remove connect function, add ConnectedComponent
closes #238
closes #235
2019-07-13 17:04:36 +02:00
Géry Debongnie af7520d869 [REF] *: reformat with prettier and printWidth=100
closes #214
2019-06-28 10:33:13 +02:00
Alexandre Kühn 0095bfa61f [IMP] store: positional arguments with dispatch/commit 2019-06-28 10:12:56 +02:00
Géry Debongnie dbfc7e4acd [FIX] store/connect: fix bugs with parent/child connected
There were big issues when we use parent/child connected widgets.

- children was rendered twice (and mapStoreToProps was called twice)
- if children was supposed to be destroyed, it was rendered once.

We solve them in this commit by waiting for parent widgets to be ready
before updating children.

closes #216
2019-06-28 09:45:43 +02:00
Géry Debongnie e6a5934162 [REF] component: use 'component' instead of 'widget' 2019-06-20 12:31:00 +02:00
Pierre Paridans 5524c2e323 [IMP] store: connected component reuse base component name
Connected component should have a unique name. To achieve this the
connected component currently have an id based generated name (like
`ConnectedComponent1`).

To make it clearer and ease debugging this commit reuse the extended
component's name to include it in the generated name in the form of
`Connected<ComponentName>`.
2019-06-20 12:26:13 +02:00
Géry Debongnie 35c1de26b8 [IMP] component: allow component name in templates
closes #186
2019-06-18 15:02:35 +02:00
Aaron Bohy a56939f13a [IMP] store: memoize getters
Closes #95
2019-06-17 15:46:48 +02:00
Aaron Bohy 22e48e3be0 [REF] store: simplify connect API
Closes #158
2019-06-11 11:41:29 +02:00
Aaron Bohy 1ff3c32fe4 [IMP] store: allow connecting to another store
Closes #58
2019-06-11 11:41:29 +02:00
Aaron Bohy d1094f647a [IMP] observer: add set and delete static functions
This rev. add a 'set' and 'delete' static functions to the Observer.
They allow to set or delete (only for objects) properties on
observed objects or arrays.

With this, the 'set' functions in Store and Component are no longer
necessary, so they have been removed.

Closes #138
2019-06-07 14:55:12 +02:00
Géry Debongnie 187eb922c0 [IMP] component: define props as attribute (remove t-props) 2019-06-03 13:34:01 +02:00
Aaron Bohy 26f14180e2 [IMP] qweb: t-ref: dyn values with string interpolation
Closes #100
2019-05-29 11:22:12 +02:00
Géry Debongnie a1e982aba5 [REF] tests: rename makeTestWEnv to makeTestEnv 2019-05-17 15:52:16 +02:00
Géry Debongnie 0a10bbc023 [IMP] component: remove support for inlineTemplate
closes #93
2019-05-15 15:54:18 +02:00
Géry Debongnie f52a15d7f6 [REF] store: make getters functions instead of properties 2019-05-10 12:10:52 +02:00
Alexandre Kühn 147f6fced7 [IMP] store: getters 2019-05-10 12:10:52 +02:00
Géry Debongnie 7f0b236747 [FIX] store: properly call patch on connected components
A previous refactoring broke it by adding a [] arguments to updateprops.
2019-05-07 14:43:23 +02:00
Géry Debongnie b7860a95b0 [REF] store: typecheck code
closes #87
closes #39
2019-05-07 11:47:09 +02:00
Géry Debongnie f7495dc897 [FIX] store: correct update order for child/parents
Not happy about the test, there was a bug in Discuss that is solved with this
commit, but I could not reproduce it in a test.

closes #85
2019-05-07 11:22:00 +02:00
Géry Debongnie 94ed6ebe60 [IMP] component: remove updateState method 2019-04-17 10:59:03 +02:00
Géry Debongnie b89327c831 [IMP] qweb: log a warning if a t-foreach is used without t-key
closes #40
2019-04-16 17:49:33 +02:00
Géry Debongnie 7092f5e142 [REF] observer: move observer out of store 2019-04-16 14:24:19 +02:00
Alexandre Kühn 73fb8f8998 [FIX] store: connected component deeply reactive with undefined, null and string props
Revision on https://github.com/odoo/owl/commit/9f77344c3a19592d4a37df43b65f9e647fe41f24

Deeply reactive version of fix above.
2019-04-15 16:54:02 +02:00
Géry Debongnie 559c51a717 [FIX] store: change default hash function to better see changes 2019-04-15 16:50:07 +02:00
Alexandre Kühn 9f77344c3a [FIX] store: connected component with undefined, null and string props 2019-04-15 15:36:18 +02:00
Géry Debongnie 3d18359dd8 [IMP] store: add 'deep' param to connect options 2019-04-15 11:51:18 +02:00
Alexandre Kühn e005090296 [IMP] store: return data from committing a mutation
closes #29
2019-04-15 10:53:59 +02:00
Alexandre Kühn 7e7226213a [IMP] store: commit a mutation in a mutation 2019-04-15 10:51:54 +02:00
Géry Debongnie 9ee85e220b [FIX] store: unobserve detached objects
closes #27
2019-04-15 10:43:50 +02:00
Géry Debongnie f5bbf25d4f [IMP] store: add deep tracking for changes
This is only at the level of the store currently. To be useful, we need
to work on the 'connect' function.
2019-04-14 21:24:54 +02:00
Géry Debongnie 4ea0875fd9 [REF] store: namespace rev under __owl__ name 2019-04-14 11:27:02 +02:00
Géry Debongnie caed076f2a [FIX] store: properly handle null values 2019-04-12 21:07:12 +02:00
Géry Debongnie 4f1d976206 [FIX] store: properly observe all array methods 2019-04-12 13:03:25 +02:00
Géry Debongnie 8ca806eb28 [IMP] store: make sure set function works with arrays 2019-04-12 12:45:44 +02:00
Géry Debongnie e0608aa7fd [IMP] store: propagate 'set' function to commit parameters 2019-04-12 12:42:14 +02:00
Géry Debongnie 111080fdbf [FIX] store: observer array values recursively 2019-04-12 12:25:22 +02:00
Géry Debongnie ab12ac8a9f [IMP] store: properly handle already observed state 2019-04-12 12:17:16 +02:00
Géry Debongnie 63069d96a5 fix: properly observe recursively new values 2019-04-12 12:08:31 +02:00
Géry Debongnie f1cc32de8f imp: prevent store state change outside a mutation 2019-04-12 12:05:06 +02:00
Géry Debongnie 03511ce9ea ref: reorganize store (based on different principles) 2019-04-12 11:57:29 +02:00
Géry Debongnie f960149ba2 rem: remove destroyed hook 2019-04-10 09:35:20 +02:00
Géry Debongnie 816ffe1b44 imp: store dispatch functions can be synchronized 2019-04-09 13:16:22 +02:00
Géry Debongnie 7ea782bd60 fix: prevent issue in store with existing values in array 2019-04-09 10:08:37 +02:00
Géry Debongnie bf4cbaea33 imp: unskip test, add new test 2019-04-09 09:14:22 +02:00
Alexandre Kühn cde85269fd imp: make store reactive (observe state and react to changes)
This is a pretty big change, yet still not complete.
2019-04-08 23:11:38 +02:00
Alexandre Kühn 3340401f54 imp: give reference to dispatch function in actions 2019-04-08 23:11:32 +02:00