Skip to content

fix: Namespace builder localStorage keys per directory type#2797

Merged
Armanul46 merged 1 commit intosovware:developmentfrom
RabbiIslamRony:fix/builder-state-sync-across-directory-types
Apr 7, 2026
Merged

fix: Namespace builder localStorage keys per directory type#2797
Armanul46 merged 1 commit intosovware:developmentfrom
RabbiIslamRony:fix/builder-state-sync-across-directory-types

Conversation

@RabbiIslamRony
Copy link
Copy Markdown
Member

PR Type

  • Bugfix
  • Security fix
  • Improvement
  • New Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Text changes
  • Other... Please describe:

Summary

Fix builder UI state (active tabs, expanded groups, widgets) carrying over between different directory types by namespacing all localStorage keys with the listing type ID.

What Changed

Function Changes

  • Add listing_type_id to Vuex store state and setListingTypeId mutation
  • Update all localStorage key generators to append _${typeId} suffix
  • Set store's listing_type_id on component mount and after save

UX Changes

  • Each directory type now maintains its own independent tab/widget state in the builder
  • Switching between directory types no longer shows the previous type's active tabs or expanded groups

UI Changes

  • No UI changes.

Files Changed

JavaScript

  • assets/src/js/admin/vue/store/CPT_Manager_Store.js — Add listing_type_id state and namespace top tab localStorage key
  • assets/src/js/admin/vue/apps/cpt-manager/CPT_Manager.vue — Set listing_type_id in store, read namespaced key on restore
  • assets/src/js/admin/vue/modules/Submenu_Module.vue — Namespace sub-tab localStorage key with type ID
  • assets/src/js/admin/vue/modules/form-fields/Form_Builder_Field.vue — Namespace expanded group localStorage key with type ID
  • assets/src/js/admin/vue/modules/form-builder-modules/widget-group-components/Form_Builder_Widget_Group_Component.vue — Namespace expanded widget localStorage key with type ID
  • assets/src/js/public/components/instantSearch.js — Code formatting cleanup
  • assets/src/js/public/search-form.js — Code formatting cleanup

How to Test

  1. Have at least 2 directory types created (e.g., "Restaurants" and "Hotels")
  2. Edit Directory Type A → click Search Form tab → expand a widget group → save
  3. Edit Directory Type B → verify it does NOT show Type A's tab/widget state
  4. Return to Directory Type A → verify its state is still preserved independently

Any linked issues

Fixes #

Checklist

Additional Context

Existing localStorage keys become orphaned after this update. Users will see a one-time tab reset to defaults on first load — this is expected and harmless.

Previously, all directory types shared the same localStorage keys for
UI state (active tabs, expanded groups, widget states). This caused
state from one directory type to carry over when switching to another.

Append listing_type_id to all localStorage keys in the CPT Manager
so each directory type maintains independent UI state.
@RabbiIslamRony RabbiIslamRony requested a review from Armanul46 April 7, 2026 10:03
@Armanul46
Copy link
Copy Markdown
Collaborator

works fine

@Armanul46 Armanul46 merged commit d421f8a into sovware:development Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants