Fix multiple bugs with ID numbering in the event editor
This commit is contained in:
parent
a537ed9ca4
commit
c4f50b3cbe
|
@ -3,6 +3,7 @@
|
||||||
import { dndzone } from "svelte-dnd-action"
|
import { dndzone } from "svelte-dnd-action"
|
||||||
import { Button, DropdownMenu, Spacer } from "@budibase/bbui"
|
import { Button, DropdownMenu, Spacer } from "@budibase/bbui"
|
||||||
import actionTypes from "./actions"
|
import actionTypes from "./actions"
|
||||||
|
import { generate } from "shortid"
|
||||||
|
|
||||||
const flipDurationMs = 150
|
const flipDurationMs = 150
|
||||||
|
|
||||||
|
@ -11,11 +12,15 @@
|
||||||
export let actions
|
export let actions
|
||||||
|
|
||||||
// dndzone needs an id on the array items, so this adds some temporary ones.
|
// dndzone needs an id on the array items, so this adds some temporary ones.
|
||||||
|
$: {
|
||||||
if (actions) {
|
if (actions) {
|
||||||
actions = actions.map((action, i) => {
|
actions.forEach(action => {
|
||||||
return { ...action, id: i }
|
if (!action.id) {
|
||||||
|
action.id = generate()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let addActionButton
|
let addActionButton
|
||||||
let addActionDropdown
|
let addActionDropdown
|
||||||
|
@ -41,7 +46,7 @@
|
||||||
const newAction = {
|
const newAction = {
|
||||||
parameters: {},
|
parameters: {},
|
||||||
[EVENT_TYPE_KEY]: actionType.name,
|
[EVENT_TYPE_KEY]: actionType.name,
|
||||||
id: actions ? actions.length + 1 : 0,
|
id: generate(),
|
||||||
}
|
}
|
||||||
if (!actions) {
|
if (!actions) {
|
||||||
actions = []
|
actions = []
|
||||||
|
|
Loading…
Reference in New Issue