Fix typical bugs
This commit is contained in:
@@ -149,9 +149,10 @@ function autoExpandLimitForTree(tree: q.Tree<TopicViewModel>) {
|
||||
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()
|
||||
|
||||
@@ -192,7 +192,7 @@ class Publish extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
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 || '',
|
||||
|
||||
@@ -79,7 +79,7 @@ class MessageHistory extends React.Component<Props, State> {
|
||||
|
||||
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,
|
||||
|
||||
@@ -180,7 +180,7 @@ class UpdateNotifier extends React.Component<Props, State> {
|
||||
let regex: RegExp
|
||||
if (os.platform() === 'darwin') {
|
||||
regex = /\.dmg$/
|
||||
} else if (os.platform() === 'darwin') {
|
||||
} else if (os.platform() === 'win32') {
|
||||
regex = /\.exe$/
|
||||
} else {
|
||||
regex = /\.AppImage$/
|
||||
|
||||
@@ -4,16 +4,17 @@ import { TopicViewModel } from './model/TopicViewModel'
|
||||
|
||||
export function sortedNodes(settings: SettingsState, treeNode: q.TreeNode<any>): Array<q.TreeNode<TopicViewModel>> {
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user