fix: reset active tab to default when opening a new or different record#56
Open
obinnaelviso wants to merge 2 commits into
Open
fix: reset active tab to default when opening a new or different record#56obinnaelviso wants to merge 2 commits into
obinnaelviso wants to merge 2 commits into
Conversation
The active tab was stored in the session under a global key (class name only), so all records sharing the same form widget shared one stored tab. Navigating to tab 3 on record A would open tab 3 on record B or on any new create form. Fix: namespace the session key per context and record ID so each record gets its own stored tab. For the create context, never read or write the tab to session — create forms always start on tab 1. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Form widget tab-state leakage across different records by scoping the stored “active tab” session entry to the form context and record identifier, so navigating tabs on one record no longer affects other records.
Changes:
- Store the active tab under a context/record-specific session key instead of a single global
activeTabslot. - Skip persisting/restoring the active tab in the
createcontext so new forms default to tab 1.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+313
to
+315
| if ($this->context !== 'create') { | ||
| $this->putSession($this->activeTabSessionKey(), $data['tab']); | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The active tab was stored in the session under a key derived solely from the form widget's class name — making it global across all records. Navigating to a non-default tab on any record would cause that same tab to be active when opening a new record or a different record.
Fixes tastyigniter/TastyIgniter#1177
Root cause
SessionMaker::makeSessionKey()returns a constant string (the widget class name). AllputSession('activeTab', ...)/getSession('activeTab')calls shared a single session slot regardless of which record was open or whether the form was in create/edit context.Fix
activeTabSessionKey()which namespaces the key per context and record ID (activeTab.edit.{id})createcontext: never read or write the active tab to session — create forms always start on tab 1editcontext: tab is remembered per individual recordBehaviour after fix
🤖 Generated with Claude Code