mirror of https://github.com/node-red/node-red.git
Fix dropped statuses when resolving missing types
parent
b939305070
commit
6a88702152
|
|
@ -529,7 +529,8 @@ var RED = (function() {
|
|||
RED.comms.subscribe("status/#",function(topic,msg) {
|
||||
var parts = topic.split("/");
|
||||
var node = RED.nodes.node(parts[1]);
|
||||
if (node) {
|
||||
// Nodes of type unknown do not have i18n
|
||||
if (node && typeof node._ === "function") {
|
||||
if (msg.hasOwnProperty("text") && msg.text !== null && /^[@a-zA-Z]/.test(msg.text)) {
|
||||
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,6 +87,15 @@ function publish(topic, data, retain, session, excludeSession) {
|
|||
})
|
||||
}
|
||||
|
||||
function republishStatus() {
|
||||
for (const topic in retained) {
|
||||
if (/^status(\/.*)?$/.test(topic)) {
|
||||
connections.forEach((connection) => {
|
||||
connection.send(topic, retained[topic]);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var api = module.exports = {
|
||||
init: function(_runtime) {
|
||||
|
|
@ -101,6 +110,8 @@ var api = module.exports = {
|
|||
events.on("comms",handleCommsEvent);
|
||||
events.removeListener("event-log",handleEventLog);
|
||||
events.on("event-log",handleEventLog);
|
||||
events.removeListener("comms:republish-status", republishStatus);
|
||||
events.on("comms:republish-status", republishStatus);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -177,6 +177,9 @@ function installModule(module,version,url) {
|
|||
}
|
||||
if (info.nodes.length) {
|
||||
events.emit("runtime-event",{id:"node/added",retain:false,payload:info.nodes});
|
||||
// If the installed module resolves missing types, nodes will be started before the editor
|
||||
// is notified of added types. Therefore, statuses published before the type resolution will be lost.
|
||||
events.emit("comms:republish-status");
|
||||
}
|
||||
}
|
||||
return info;
|
||||
|
|
|
|||
Loading…
Reference in New Issue