Fix typical bugs
This commit is contained in:
@@ -149,9 +149,10 @@ function autoExpandLimitForTree(tree: q.Tree<TopicViewModel>) {
|
|||||||
if (!tree) {
|
if (!tree) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function closestExistingLimit(i: number): number {
|
function closestExistingLimit(i: number): number {
|
||||||
const sorted = autoExpandLimitSet.sort((a, b) => Math.abs(a.limit - i) - Math.abs(b.limit - i))
|
const sorted = [...autoExpandLimitSet].sort((a, b) => Math.abs(a.limit - i) - Math.abs(b.limit - i))
|
||||||
return sorted[0]!.limit
|
return sorted[0].limit
|
||||||
}
|
}
|
||||||
|
|
||||||
const count = tree.childTopicCount()
|
const count = tree.childTopicCount()
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class Publish extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private history() {
|
private history() {
|
||||||
const items = this.state.history.reverse().map(message => ({
|
const items = [...this.state.history].reverse().map(message => ({
|
||||||
key: sha1(message.topic + message.payload),
|
key: sha1(message.topic + message.payload),
|
||||||
title: message.topic,
|
title: message.topic,
|
||||||
value: message.payload || '',
|
value: message.payload || '',
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class MessageHistory extends React.Component<Props, State> {
|
|||||||
|
|
||||||
const history = node.messageHistory.toArray()
|
const history = node.messageHistory.toArray()
|
||||||
let previousMessage: q.Message | undefined = node.message
|
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 value = message.value ? Base64Message.toUnicodeString(message.value) : ''
|
||||||
const element = {
|
const element = {
|
||||||
value,
|
value,
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class UpdateNotifier extends React.Component<Props, State> {
|
|||||||
let regex: RegExp
|
let regex: RegExp
|
||||||
if (os.platform() === 'darwin') {
|
if (os.platform() === 'darwin') {
|
||||||
regex = /\.dmg$/
|
regex = /\.dmg$/
|
||||||
} else if (os.platform() === 'darwin') {
|
} else if (os.platform() === 'win32') {
|
||||||
regex = /\.exe$/
|
regex = /\.exe$/
|
||||||
} else {
|
} else {
|
||||||
regex = /\.AppImage$/
|
regex = /\.AppImage$/
|
||||||
|
|||||||
@@ -4,16 +4,17 @@ import { TopicViewModel } from './model/TopicViewModel'
|
|||||||
|
|
||||||
export function sortedNodes(settings: SettingsState, treeNode: q.TreeNode<any>): Array<q.TreeNode<TopicViewModel>> {
|
export function sortedNodes(settings: SettingsState, treeNode: q.TreeNode<any>): Array<q.TreeNode<TopicViewModel>> {
|
||||||
const topicOrder = settings.get('topicOrder')
|
const topicOrder = settings.get('topicOrder')
|
||||||
let edges = treeNode.edgeArray
|
const edges = [...treeNode.edgeArray]
|
||||||
|
|
||||||
if (topicOrder === TopicOrder.abc) {
|
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) {
|
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) {
|
if (topicOrder === TopicOrder.topics) {
|
||||||
nodes = nodes.sort((a, b) => b.childTopicCount() - a.childTopicCount())
|
nodes.sort((a, b) => b.childTopicCount() - a.childTopicCount())
|
||||||
}
|
}
|
||||||
return nodes
|
return nodes
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user