luci-mod-network: fix handleAdd in wireless.js
authorPaul Donald <[email protected]>
Tue, 1 Apr 2025 12:28:03 +0000 (14:28 +0200)
committerPaul Donald <[email protected]>
Tue, 8 Apr 2025 22:25:35 +0000 (00:25 +0200)
handleAdd did not work correctly for a while: some state was not cleaned
up (try: wireless -> add -> no changes -> click dismiss -> press save).

The state is now properly removed when pressing dismiss, by stashing
addedSection correctly under the map m and not in this.

Also requires a null check in render_modal_status.

Signed-off-by: Paul Donald <[email protected]>
(cherry picked from commit 6c061b644c1380b841542f44179195756cc5a645)

modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js

index b9d5551799e7b697b9dafd31c685473ef07750aa..ed077aeeb99f886e7b725a8719815ae13b0d0982 100644 (file)
@@ -152,6 +152,8 @@ function render_network_status(radioNet) {
 }
 
 function render_modal_status(node, radioNet) {
+       if (!radioNet) return;
+
        const mode = radioNet.getActiveMode();
        const noise = radioNet.getNoise();
        const bssid = radioNet.getActiveBSSID();
@@ -2299,7 +2301,7 @@ return view.extend({
                        uci.set('wireless', section_id, 'ssid', 'OpenWrt');
                        uci.set('wireless', section_id, 'encryption', 'none');
 
-                       this.addedSection = section_id;
+                       m.addedSection = section_id;
                        return this.renderMoreOptionsModal(section_id);
                };