# Javascript simplification

**URL:** https://discourse.nodered.org/t/javascript-simplification/99707
**Category:** Dashboard
**Tags:** dashboard-2
**Created:** [18 November 2025 14:37 UTC](https://discourse.nodered.org/t/javascript-simplification/99707 "2025-11-18T14:37:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 November 2025 14:37 UTC](https://discourse.nodered.org/t/javascript-simplification/99707/1 "2025-11-18T14:37:10Z")

</div>

In the flowfuse dashboard code in nodes/widgets/ui-text.js I see the code

```auto
            // Process the value using TypedInput configuration
            const processValue = async () => {
                const value = msg.payload // default to payload if evaluation fails

                if (config.valueType && config.value) {
                    const results = await asyncEvaluateNodeProperty(RED, config.value, config.valueType, node, msg)
                    msg.payload = results
                } else {
                    msg.payload = value
                }
            }

            try {
                await processValue()
            } catch (err) {
                node.warn('Error evaluating value property: ' + err.message)
                // msg.payload remains unchanged on error
            }

```

Am I right in thinking that processValue() can simplified to

```auto
            // Process the value using TypedInput configuration
            const processValue = async () => {
                // defaults to leaving existing payload untouched if evaluation fails
                if (config.valueType && config.value) {
                    msg.payload = await asyncEvaluateNodeProperty(RED, config.value, config.valueType, node, msg)
                }
            }

```

Or is there some subtlety that I am missing?

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [18 November 2025 14:50 UTC](https://discourse.nodered.org/t/javascript-simplification/99707/2 "2025-11-18T14:50:50Z")

</div>

I think you're right. Can't see any gotchas hidden in there.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 November 2025 17:22 UTC](https://discourse.nodered.org/t/javascript-simplification/99707/3 "2025-11-18T17:22:59Z")

</div>

OK, thanks. I will create a PR. It is only a small thing, but it is good to reduce the amount of code rather than continually increasing it. Slightly offsetting the rule that the amount of code in a system innexorably grows to use up all the available resources.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [27 November 2025 16:12 UTC](https://discourse.nodered.org/t/javascript-simplification/99707/4 "2025-11-27T16:12:45Z")

</div>

> <https://github.com/FlowFuse/node-red-dashboard/pull/1943>
>
> \## Description
> 
> Remove a few lines of redundant code in ui\_text.js
> 
> See http…s://discourse.nodered.org/t/javascript-simplification/99707 for discussion
> 
> \## Related Issue(s)
> 
> 
> 
> \## Checklist
> 
> 
> 
> - \[x \] I have read the \[contribution guidelines\](https://github.com/FlowFuse/flowfuse/blob/main/CONTRIBUTING.md)
> - \[\] Suitable unit/system level tests have been added and they pass 
> - \[\] Documentation has been updated
> - \[\] Upgrade instructions
> - \[\] Configuration details
> - \[\] Concepts
> - \[\] Changes \`flowforge.yml\`?
> - \[\] Issue/PR raised on \`FlowFuse/helm\` to update ConfigMap Template
> - \[\] Issue/PR raised on \`FlowFuse/CloudProject\` to update values for Staging/Production
> - \[\] Link to Changelog Entry PR, or note why one is not needed.
> 
> \## Labels
> 
> - \[\] Includes a DB migration? -\> add the \`area:migration\` label

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [25 February 2026 16:13 UTC](https://discourse.nodered.org/t/javascript-simplification/99707/5 "2026-02-25T16:13:36Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
