Skip to content

Commit

Permalink
Fix an issue where the template input didn't load the first template …
Browse files Browse the repository at this point in the history
…selection after another type of item was selected

Signed-off-by: Axel Boberg <[email protected]>
  • Loading branch information
axelboberg committed Mar 26, 2024
1 parent e86505c commit 990eb0e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions plugins/caspar/app/views/InspectorTemplate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ export const InspectorTemplate = () => {
changes to not interfere with writing in the editor
*/
React.useEffect(() => {
const items = selection.map(id => state?.items?.[id])
const value = items?.[0]?.data?.caspar?.templateDataString
setId(items?.[0]?.id)
setValue(value)
async function loadSelection () {
const item = await bridge.items.getItem(selection[0])
setId(item?.id)
setValue(item?.data?.caspar?.templateDataString)
}

loadSelection()
}, [JSON.stringify(selection)])

function handleNewValue (set) {
Expand Down

0 comments on commit 990eb0e

Please sign in to comment.