Skip to content

Commit

Permalink
Fix deleted groups still displaying on new Neo block types
Browse files Browse the repository at this point in the history
  • Loading branch information
ttempleton committed Jul 19, 2022
1 parent 301cfdf commit b519622
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Unreleased

### Fixed
- Fixed a bug where deleted field groups would still appear on new Neo block type field layouts

## 1.0.0 - 2022-06-29

### Added
Expand Down
2 changes: 2 additions & 0 deletions src/resources/js/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
LOADING: 'loading',
LOADED: 'loaded',
loadStatus: null,
groups: null,

/**
* The constructor.
Expand All @@ -33,6 +34,7 @@
if(textStatus === 'success' && response.success)
{
this.loadStatus = this.LOADED;
this.groups = response.groups
this.trigger('load', {
template: response.template,
groups: response.groups,
Expand Down
4 changes: 4 additions & 0 deletions src/resources/js/QuickField.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
this.modal = QuickField.FieldModal.getInstance();
this.loader = QuickField.Loader.getInstance();

if (this.loader.loadStatus === this.loader.LOADED) {
this._initGroups(this.loader.groups)
}

this.addListener(this.$groupButton, 'activate', 'newGroup');
this.addListener(this.$fieldButton, 'activate', 'newField');

Expand Down

0 comments on commit b519622

Please sign in to comment.