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.

Action's parameters are not being passed correctly

See original GitHub issue

Describe the bug When you pass a list of parameters to an action, only the last parameter in the list is being received by the function. What’s more, the parameter is being “moved” to the first position.

<script>	
	function test (node, el1, el2, el3) {
		console.log(el1, el2, el3) // logs `third undefined undefined`, instead of `first second third`
	}
</script>

<h1 use:test={'first', 'second', 'third'}>Hello!</h1>

This used to work in 3.12.1 but it doesn’t work in 3.24.0

To Reproduce Open the this REPL and see the logs. Compare the logs with that one.

Expected behavior Parameters should be passed correctly.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mindronescommented, Jul 21, 2020

We agreed to rephrase a bit to clarify that actions can have just one parameter (although the signature is correct), re-opening.

1reaction
pngwncommented, Jul 21, 2020

Multiple parameters working was a bug and we have fixed that now.

@yuliankarapetkov

I see, it used to work differently in 3.12.1 and then maybe in this case the log should show first, not third, right?

No, the current behaviour is expected. The argument you provide to an action is an expression that is passed as the second parameter to the action function:

<div use:fn={1, 2, 3} />

Is actually doing this:

fn(
  node, 
  (1, 2, 3)
)

Evaluating the expression (1, 2, 3) will return 3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parameters not being properly passed to controller action ...
I've noticed that only the first parameter ( p1 ) is getting a value from the front end; all my other parameters are...
Read more >
Parameter Actions - Tableau
You can use parameter actions with reference lines, calculations, filters, and SQL queries, and to customize how you display data in your visualizations....
Read more >
Passing parameters
Passing parameters. Parameters are additional information to be used in the recipe in the form of datapills. Defining parameters in the Workbot trigger ......
Read more >
How to pass input parameter of Client Action in javascript?
From Javascript, I'm Trying to call a client action which takes an input parameters. Something like: Response = setTimeout(function() { $actions.Click() // No...
Read more >
Named and Optional Arguments - C# Programming Guide
Named arguments in C# specify arguments by name, not position. ... In the example below, the parameter orderNum is in the correct position ......
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