fix: Restore button now sends you to Active tab where the note lives (v3.4.1)

After v3.4.0 introduced the Active/Completed tab strip, clicking
Restore on a completed note appeared to do nothing — the restored
note never showed up. David: "the complete log does not return
to active."

Root cause: the Restore handler in wp_notes_page_callback() was
the only action handler without a wp_redirect() + exit; after its
update_option() calls. Every other handler (new note, mark-as-done
single, mark-as-done bulk) had one. So Restore relied on the page
falling through and re-rendering, which used to work when both
Active and Completed sections rendered on the same page (user
could glance up to see the restored note in the Active section).

v3.4.0's single-pane tab render exposed the latent bug: after
Restore, the URL still says ?tab=completed, so only Completed
re-renders (minus the now-restored note), and the restored note
is invisible on Active.

Fix: add the missing redirect to admin.php?page=wp-notes (defaults
to Active tab) after the restore completes. The restored note now
appears in its new home immediately.

Patch bump — bug fix only, no API or behavioural changes beyond
the fix itself. Other handlers, storage model, tab structure, and
CSS are unchanged.
This commit is contained in:
2026-05-26 09:07:27 +01:00
parent c5d8a34296
commit 431c31a95b
2 changed files with 38 additions and 4 deletions
+22
View File
@@ -9,6 +9,28 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versi
--- ---
## [3.4.1] — 2026-05-27
### Fixed — Restore button now sends you to the Active tab where the restored note lives
After v3.4.0 introduced the Active/Completed tab strip, clicking **Restore** on a completed note appeared to "do something" but the restored note never showed up. David reported it as *"the complete log does not return to active."*
Root cause: the Restore action handler in `wp_notes_page_callback()` (line ~1340) was the **only** action handler in the file without a `wp_redirect() + exit;` after its `update_option()` calls — every other handler (new note, mark-as-done single, mark-as-done bulk) had one. So Restore was relying on the page falling through and re-rendering, which used to work when both Active and Completed sections rendered on the same page (the user could just glance up to see the restored note in the Active section). v3.4.0's single-pane tab render exposed the latent bug: after Restore, the URL still said `?tab=completed`, so only Completed re-rendered (minus the now-restored note), and the restored note was invisible on Active.
Fix: add the missing redirect to `admin.php?page=wp-notes` (which defaults to the Active tab) after the restore completes. The restored note now appears in its new home immediately.
### Files changed
- `wp-notes.php``wp_notes_page_callback()` Restore handler: added `wp_redirect(admin_url('admin.php?page=wp-notes')); exit;` after the two `update_option()` calls. Five-line change plus a load-bearing comment explaining the bug history so future-Claude doesn't reintroduce it.
- Plugin header `Version: 3.4.0 → 3.4.1`; `WP_NOTES_VERSION` constant updated to match. PATCH bump (bug fix, no API or behavioural changes beyond the fix itself).
### Not changed
- The other three action handlers (new note, mark-as-done) — they already had correct redirects; no need to touch.
- Storage model, tab structure, CSS — all unchanged from v3.4.0.
---
## [3.4.0] — 2026-05-27 ## [3.4.0] — 2026-05-27
### Added — Active / Completed tabs on the My Log page ### Added — Active / Completed tabs on the My Log page
+14 -2
View File
@@ -5,7 +5,7 @@
* Plugin Name: Logbook * Plugin Name: Logbook
* Plugin URI: https://icanhelp.ie/wp-notes * Plugin URI: https://icanhelp.ie/wp-notes
* Description: A lightweight task & logbook plugin for WordPress. Log your daily work, mark tasks done, and keep a tidy record inside the dashboard. Perfect for freelancers showing clients what's been delivered and students proving work to teachers. * Description: A lightweight task & logbook plugin for WordPress. Log your daily work, mark tasks done, and keep a tidy record inside the dashboard. Perfect for freelancers showing clients what's been delivered and students proving work to teachers.
* Version: 3.4.0 * Version: 3.4.1
* Requires at least: 5.0 * Requires at least: 5.0
* Requires PHP: 7.2 * Requires PHP: 7.2
* Author: IR240474 * Author: IR240474
@@ -33,7 +33,7 @@ if (!isset($wp_notes_init)) {
$wp_notes_init = true; $wp_notes_init = true;
// Plugin Constants // Plugin Constants
if (!defined('WP_NOTES_VERSION')) define('WP_NOTES_VERSION', '3.4.0'); if (!defined('WP_NOTES_VERSION')) define('WP_NOTES_VERSION', '3.4.1');
if (!defined('WP_NOTES_FILE')) define('WP_NOTES_FILE', __FILE__); if (!defined('WP_NOTES_FILE')) define('WP_NOTES_FILE', __FILE__);
if (!defined('WP_NOTES_PATH')) define('WP_NOTES_PATH', plugin_dir_path(__FILE__)); if (!defined('WP_NOTES_PATH')) define('WP_NOTES_PATH', plugin_dir_path(__FILE__));
if (!defined('WP_NOTES_URL')) define('WP_NOTES_URL', plugin_dir_url(__FILE__)); if (!defined('WP_NOTES_URL')) define('WP_NOTES_URL', plugin_dir_url(__FILE__));
@@ -1355,6 +1355,18 @@ function wp_notes_handle_actions() {
update_option('wp_notes', $notes); update_option('wp_notes', $notes);
update_option('wp_done_notes', $new_done_notes); update_option('wp_done_notes', $new_done_notes);
// v3.4.1 fix: redirect to the Active tab so the restored note is
// visible in its new home. Without this redirect, the page falls
// through and re-renders with the URL's current ?tab=completed,
// so the user sees Completed (minus the now-restored note) and
// can't see the restored note on Active. The other action
// handlers above (new note, mark-as-done single, mark-as-done
// bulk) all redirect; restore was the odd one out. Pre-v3.4.0
// this was masked because both sections rendered on the same
// page — the v3.4.0 single-pane tab render exposed it.
wp_redirect(admin_url('admin.php?page=wp-notes'));
exit;
} }
// Handle edit note action // Handle edit note action