diff --git a/app/src/actions/Settings.ts b/app/src/actions/Settings.ts index e69a178..c423efc 100644 --- a/app/src/actions/Settings.ts +++ b/app/src/actions/Settings.ts @@ -149,9 +149,10 @@ function autoExpandLimitForTree(tree: q.Tree) { if (!tree) { return 0 } + function closestExistingLimit(i: number): number { - const sorted = autoExpandLimitSet.sort((a, b) => Math.abs(a.limit - i) - Math.abs(b.limit - i)) - return sorted[0]!.limit + const sorted = [...autoExpandLimitSet].sort((a, b) => Math.abs(a.limit - i) - Math.abs(b.limit - i)) + return sorted[0].limit } const count = tree.childTopicCount() diff --git a/app/src/components/Sidebar/Publish/Publish.tsx b/app/src/components/Sidebar/Publish/Publish.tsx index 576efd0..87b594c 100644 --- a/app/src/components/Sidebar/Publish/Publish.tsx +++ b/app/src/components/Sidebar/Publish/Publish.tsx @@ -192,7 +192,7 @@ class Publish extends React.Component { } private history() { - const items = this.state.history.reverse().map(message => ({ + const items = [...this.state.history].reverse().map(message => ({ key: sha1(message.topic + message.payload), title: message.topic, value: message.payload || '', diff --git a/app/src/components/Sidebar/ValueRenderer/MessageHistory.tsx b/app/src/components/Sidebar/ValueRenderer/MessageHistory.tsx index 0b500f7..d1c6a40 100644 --- a/app/src/components/Sidebar/ValueRenderer/MessageHistory.tsx +++ b/app/src/components/Sidebar/ValueRenderer/MessageHistory.tsx @@ -79,7 +79,7 @@ class MessageHistory extends React.Component { const history = node.messageHistory.toArray() let previousMessage: q.Message | undefined = node.message - const historyElements = history.reverse().map((message, idx) => { + const historyElements = [...history].reverse().map((message, idx) => { const value = message.value ? Base64Message.toUnicodeString(message.value) : '' const element = { value, diff --git a/app/src/components/UpdateNotifier.tsx b/app/src/components/UpdateNotifier.tsx index 481c879..9deab94 100644 --- a/app/src/components/UpdateNotifier.tsx +++ b/app/src/components/UpdateNotifier.tsx @@ -180,7 +180,7 @@ class UpdateNotifier extends React.Component { let regex: RegExp if (os.platform() === 'darwin') { regex = /\.dmg$/ - } else if (os.platform() === 'darwin') { + } else if (os.platform() === 'win32') { regex = /\.exe$/ } else { regex = /\.AppImage$/ diff --git a/app/src/sortedNodes.tsx b/app/src/sortedNodes.tsx index 352864b..e6cf151 100644 --- a/app/src/sortedNodes.tsx +++ b/app/src/sortedNodes.tsx @@ -4,16 +4,17 @@ import { TopicViewModel } from './model/TopicViewModel' export function sortedNodes(settings: SettingsState, treeNode: q.TreeNode): Array> { const topicOrder = settings.get('topicOrder') - let edges = treeNode.edgeArray + const edges = [...treeNode.edgeArray] + if (topicOrder === TopicOrder.abc) { - edges = edges.sort((a, b) => a.name.localeCompare(b.name)) + edges.sort((a, b) => a.name.localeCompare(b.name)) } - let nodes = edges.map(edge => edge.target) + const nodes = edges.map(edge => edge.target) if (topicOrder === TopicOrder.messages) { - nodes = nodes.sort((a, b) => b.leafMessageCount() - a.leafMessageCount()) + nodes.sort((a, b) => b.leafMessageCount() - a.leafMessageCount()) } if (topicOrder === TopicOrder.topics) { - nodes = nodes.sort((a, b) => b.childTopicCount() - a.childTopicCount()) + nodes.sort((a, b) => b.childTopicCount() - a.childTopicCount()) } return nodes }