question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Functions with dependencies are not updated

See original GitHub issue

Describe the bug When rendering content (ie text) my expectation was that i could put the expression into a function on the context object and have the content updated whenever the depencency (ie count) is changed.

To Reproduce Intuitively I would expect both buttons to show the same text:

<div l-use="{ count: 0, text() { return this.count + ' hi'; } }">
  <button l-text="text()" l-on:click="++count">0</button>
  <button l-text="count + ' hi'" l-on:click="++count">0</button>
</div>

If this is not intended or should be done any other way, it’s probably because the documentation is a bit scarce…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
shadowtime2000commented, Nov 1, 2020

Good point, the documentation doesn’t reflect the intended use. I will update that. @phoet feel free to open a PR to update it yourself too.

1reaction
shadowtime2000commented, Nov 1, 2020

@phoet I don’t believe it is actually possible with our current structure to update the dependencies of functions. Use pure functions like this. If you feel that we should allow updating dependencies of functions feel free to open a feature request.

<div l-use="{ count: 0, text(count) { return count + ' hi'; } }">
  <button l-text="text(count)" l-on:click="++count">0</button>
  <button l-text="count + ' hi'" l-on:click="++count">0</button>
</div>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependencies in React useEffect cleanup function are not ...
I am facing a strange issue when trying to call a cleanup function on component unmount with useEffect. In my useEffect return I...
Read more >
How to Ensure That Your Dependencies Are Up to Date
Dependency management is a common challenge when scaling apps. Here are some easy ways to keep your dependencies up to date.
Read more >
Dependencies Slow to Update + Way to force dependencies ...
I have a relatively simple plan ~ 50 tasks, and total of about 100 sub tasks. I've only just added the dependencies for...
Read more >
Updating the Dependencies
Updating dependencies should be a regular part of your job. Use our DX Scanner practice called DependeciesVersion to find out if the libraries...
Read more >
Update of local dependencies does not work #7426 - GitHub
I have some local dependencies on sub-modules in the same git repo ... If npm install does not update dependencies with local paths...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found