Commit Graph

1299 Commits

Author SHA1 Message Date
Géry Debongnie c7af885f43 [IMP] compiler: improve generated compiled code 2022-02-11 10:46:44 +01:00
Géry Debongnie bd5637c0a3 [FIX] useEffect: can depend on dom dependencies
Because the dependencies are now computed in patched.
2022-02-11 10:46:44 +01:00
Géry Debongnie 3c98ef8cb1 [FIX] portal: do not crash in dev mode
Before this commit, the props validation would fail in dev mode because
it did not expect a slot prop.
2022-02-11 10:46:44 +01:00
Géry Debongnie aad6b806ba [IMP] app: improve API, small refactoring 2022-02-11 10:46:44 +01:00
Géry Debongnie 772c275bd4 [REF] build: do not output const enum definitions
We only use 2 const enums in the codebase, but they are defined in the
output, even though this is not useful in any way. This commit reduces
the final output by about 30 loc.
2022-02-11 10:46:44 +01:00
Géry Debongnie 416deeb865 [REM] component: remove support for css tag 2022-02-11 10:46:44 +01:00
Géry Debongnie 7e40fa300a [IMP] components: improve props validation
to be able to specify that additional props are allowed
2022-02-11 10:46:44 +01:00
Lucas Perais (lpe) cc1eea0945 [FIX] component: error_handling when an error is rethrown 2022-02-11 10:46:44 +01:00
Géry Debongnie bf9cceb56f [REF] components: remove .el 2022-02-11 10:46:44 +01:00
Géry Debongnie 7eaecac0b5 [REF] tests: improve test helpers
- remove snapshotApp
- remove addTemplates
- simplify helpers
- make sure snapshotted templates are snapshotted with the app config
2022-02-11 10:46:44 +01:00
Lucas Perais (lpe) ddc358f48a [FIX] fiber, lifecycle: trigger a render during the fiber.complete
Have a component which does a render in its onWillPatch, onPatched, onMounted hooks.

Before this commit, the result was incorrect: the second rendering was not taken into account.

After this commit, those renderings are correctly applied at the price of a delayed render when the fiber
is in a critical state.
2022-02-11 10:46:44 +01:00
Géry Debongnie e2819323ee [FIX] blockdom: properly handle falsy attributes
This commit fixes some issues with falsy attributes not being properly
set/removed in various situations. Also, the behaviour was not
consistent between normal attribute (key/value) and generic attributes
(pair or object)
2022-02-11 10:46:44 +01:00
Géry Debongnie 983b9f996d [FIX] components: improve error handling
Owl provides a way to manage errors occuring in component lifecycle
methods. However, before this commit, these errors were not always
logged or visible, which is very annoying in the common developer
workflow (doing something, checking it works, seeing no error but a
broken interface).

In this commit, we make sure errors are logged/throws in all cases:

- if an error occurs in a mounting operation => the promise is rejected
(which will log the error)
- if an error occurs after the mounting operation and is not handled by
any error handlers => the error will be logged (with console.error).
Also, in that case, this commit adds a warning to explain that owl
destroys the root component, which will help developers understanding
what happened.
2022-02-11 10:46:44 +01:00
Géry Debongnie fd295b3be3 [FIX] compiler: properly handle <t> tags in some cases
The problem was that the compiler is based on the assumption that the
multi block received by the parser only occurs in some cases
where the structure of the template require a multi block, and it does
not work when we have random multiblock elsewhere.

We could fix the issue by modifying the code generator code to support
these usecases, or by simply removing these cases in the parser. Since
this seems more efficient, this is the approach taken by this commit.

Note that it was a good opportunity to simplify the parser.
2022-02-11 10:46:44 +01:00
Géry Debongnie e675f7ff5b [DOC] update changelog 2022-02-11 10:46:44 +01:00
Géry Debongnie 702fb3b253 [DOC] reorganize doc, unskip test, fix some links 2022-02-11 10:46:44 +01:00
Géry Debongnie 63fbcf99fd [FIX] blockdom: ignore attributes with undefined value 2022-02-11 10:46:44 +01:00
Géry Debongnie 14a6289f60 [IMP] component: add .bind suffix to props for easy binding 2022-02-11 10:46:44 +01:00
Lucas Perais (lpe) 894deed13b [FIX] component: render in delayed willUpdateProps
Have a child component on which a render is triggered.
This component delays its willUpdateProps and makes a rendering during the willUpdateProps

Before this commit, renderings of the child were inconsistent across
its parent's renderings.

After this commit, it works as expected.
2022-02-11 10:46:44 +01:00
Lucas Perais (lpe) 6f435c36d8 [FIX] app: factorize to allow smoother developments in projects
It should be usefull to allow developpers to implement mounting/unmounting
if they wish to.
2022-02-11 10:46:44 +01:00
Lucas Perais (lpe) 5dddf8f9a3 [FIX] blockdom: do not propagate svg namespace to siblings 2022-02-11 10:46:44 +01:00
Lucas Perais (lpe) 463eb4bb86 [FIX] hooks: useSubEnv supports arbitrary descriptors in env
Before this commit, when defining a getter in the env passed to useSubEnv,
the value was read, losing the definition of the property.

After this commit, declaring a getter in the env works as expected:
the property stays a getter.
2022-02-11 10:46:44 +01:00
Lucas Perais (lpe) b66d5231d3 [FIX] app: support for arbitrary descriptors in env
Before this commit, when defining a getter in the env passed to the App,
the value was read, losing the definition of the property.

After this commit, declaring a getter in the env works as expected:
the property stays a getter.
2022-02-11 10:46:44 +01:00
Lucas Perais (lpe) 3c12519277 [FIX] parser: correctly parse pre node within a div with new lines 2022-02-11 10:46:44 +01:00
Lucas Perais (lpe) c1a973a4d8 [FIX] component: error handling in class inheritance
Before this commit, class inheritance when using the onError hook was unclear nay wrong.

After this commit, error handlers are called from the bottom up  in the inheritance hierarchy.
If a handler doesn't rethrow the error, the handling stops there and no other handler is called.
If a handler does rethrow, the handlers declared in a parent class are executed.
2022-02-11 10:46:44 +01:00
Géry Debongnie e91e50a812 [REF] compiler: simplify all compiled templates 2022-02-11 10:46:44 +01:00
Géry Debongnie 2e176f135d [FIX] compiler: allow t-if with empty content 2022-02-11 10:46:44 +01:00
Géry Debongnie 49c7585998 [REF] components: unskip concurrency test 2022-02-11 10:46:44 +01:00
Géry Debongnie f32b1deb2c [FIX] move error handling out of fiber, fix complicated mounted issues 2022-02-11 10:46:44 +01:00
Géry Debongnie 1da3ecdbee [FIX] component: improve error handling
In the following situation: A parent of B, B parent of C, with an error
when C is mounted, caught by B and retriggering a rendering in B, then
the onMounted hook of A wasn't properly called. This commit fixes this
problem.
2022-02-11 10:46:44 +01:00
Géry Debongnie a1c619f094 [FIX] blockdom: properly handle references
Before this commit, there were situations where the reference numbers
were not properly set, which caused the blocks generated to crash
because the algorithm could not get correct references.
2022-02-11 10:46:44 +01:00
Géry Debongnie eceb3e6280 [IMP] component: render does not return a promise anymore 2022-02-11 10:46:44 +01:00
Géry Debongnie 8a1ac13975 [IMP] add support for top level comments 2022-02-11 10:46:44 +01:00
Géry Debongnie 779003e715 [REF] component: remove onDestroyed, implement onWillDestroy 2022-02-11 10:46:44 +01:00
Géry Debongnie 8c600fa539 [TESTS] test lifecycle in reactivity tests 2022-02-11 10:46:44 +01:00
Géry Debongnie bcc4fe2a27 [REF] tests: improve useLogLifecycle and helpers 2022-02-11 10:46:44 +01:00
Samuel Degueldre bb4948f3dc [FIX] reactivity: only call clearReactivesForCallback once on unmount 2022-02-11 10:46:44 +01:00
Samuel Degueldre cc4480e001 [FIX] reactivity: fix memory leak 2022-02-11 10:46:44 +01:00
Géry Debongnie 7143c2e39b [FIX] compiler: readd template name in compiled code 2022-02-11 10:46:44 +01:00
Géry Debongnie a8d8310b8e [REF] code_generator: move generating code to CodeTarget
Before this commit, we had two places with code that generate a function
code. Now, all this code is moved in a method 'generateCode' on
CodeTarget.
2022-02-11 10:46:44 +01:00
Géry Debongnie 0bbea351a6 [FIX] compiler: call dynamic templates with correct this 2022-02-11 10:46:44 +01:00
Géry Debongnie 2601a176c4 [FIX] slots: properly bind this in t-on arrow functions 2022-02-11 10:46:44 +01:00
Géry Debongnie 05a57d6da5 [REF] component: small cleanup
This commit makes it simpler to understand the way fibers are assigned
to nodes.
2022-02-11 10:46:44 +01:00
Géry Debongnie e6e6c31632 [FIX] component: concurrency issue
When a parent and a child were rendered at the same time, it was
possible for the 2 renders to decrement the same fiber internal
counter, which meant that the render was stalled.
2022-02-11 10:46:44 +01:00
Samuel Degueldre 3f66d9fe6c [FIX] slots: allow t-call and components in slot default content 2022-02-11 10:46:44 +01:00
Bruno Boi 5d8141a67c [IMP] owl: upgrade rollup-plugin-typescript2 to version 0.31.1 2022-02-11 10:46:44 +01:00
Samuel Degueldre 6459d8d289 [IMP] parser: normalize document before parsing 2022-02-11 10:46:44 +01:00
Samuel Degueldre 2943ca3921 [IMP] components: add test for template string in props 2022-02-11 10:46:44 +01:00
Samuel Degueldre 4866ed8e8a [IMP] parser: throw when using unsupported directive on component 2022-02-11 10:46:44 +01:00
Samuel Degueldre 93b88cad8d [FIX] components: allow prop names that are not valid bare property name 2022-02-11 10:46:44 +01:00