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.

Removing first item in type array not working as expected

See original GitHub issue

Test Schema:

    "properties": 
    {
            "users": {
            "type": "array",
            "description": "",
            "title": "Users",
            "items": {
                "type": "object",
                "dswaPath": ["lastName"],
                "properties": {
                    "lastName": {
                        "type": "string",
                        "description": "Last name",
                        "minLength": 2,
                        "maxLength": 30
                    },
                    "firstName": {
                        "type": "string",
                        "description": "First name",
                        "minLength": 2,
                        "maxLength": 30
                    }
                },
                "fieldsets": [
                    {
                        "id": "fieldset-default",
                        "title": "Users",
                        "fields": [
                            "lastName",
                            "firstName"
                        ]
                    }
                ]
                
                

                }
            }
    },
    "buttons": [{
		"label": "Alert",
		"id": "alert"
	},
	{
		"label": "Reset",
		"id": "reset"
	}]
}

  1. Add two users.
  2. set User 1 first name to: John
  3. set User 2 first name to: Bob
  4. Click Remove Button under the first user

Expected result: Only user Bob will remain Actual result: user John remained

Tested by cloning from master and using “tests” directory.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
ebrehaultcommented, Jan 10, 2018

Fixed using the @marc101101 solution. Thanks! Note: next time, make directly a pull request 😃

1reaction
marc101101commented, Oct 24, 2017

Same problem. This is a real bug

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove all element from array except the first one in ...
You can set the length property of the array. var input = ['a','b','c','d','e','f']; input.length = 1; console.log(input);. Run code snippet
Read more >
Array.prototype.shift() - JavaScript - MDN Web Docs
The shift() method removes the first element from an array and returns that removed element. This method changes the length of the array....
Read more >
Removing Items from an Array in JavaScript
To remove an item from array via its index, we'll first introduce the Array.prototype.splice method and then investigate a better pattern using ...
Read more >
about Arrays - PowerShell
An array is a data structure that is designed to store a collection of items. The items can be the same type or...
Read more >
Removing elements: remove, clear, removeWhere
line 2 • The name 'int' isn't a type so it can't be used as a type argument. · line 9 • Expected...
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