Skip to content

Commit

Permalink
Fixed: Issues with stimulus controllers (#409)
Browse files Browse the repository at this point in the history
* Fixed issue

* Fixed issues

* Fixed issues

* Updated version

* Fixed standard js

* Fixed changelog
  • Loading branch information
MiguelFrias97 authored Jun 12, 2024
1 parent fa7982a commit 1d4039d
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.2] - 2024-06-06

### Fixed
- Cannot read properties of undefined (reading 'destroy') in `stimulus` controllers.
- Missing target element "menu" for "navbar" controller

## [1.2.1] - 2024-05-20

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bali_view_components (1.2.1)
bali_view_components (1.2.2)
caxlsx
rails (>= 7.0.2)
ransack
Expand Down Expand Up @@ -171,7 +171,7 @@ GEM
mini_portile2 (2.8.6)
minitest (5.22.3)
mutex_m (0.2.0)
net-imap (0.4.11)
net-imap (0.4.12)
date
net-protocol
net-pop (0.1.2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class DatepickerController extends Controller {
}

disconnect () {
this.flatpickr.destroy()
this.flatpickr?.destroy()
}

defaultDates () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class SlimSelectController extends Controller {
}

disconnect () {
this.select.destroy()
this.select?.destroy()
}

dataWithHTML () {
Expand Down
2 changes: 1 addition & 1 deletion app/components/bali/chart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class ChartController extends Controller {
}

disconnect () {
this.chart.destroy()
this.chart?.destroy()
this.chart = undefined
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class PopupController extends Controller {
}

disconnect () {
this.popperInstance.destroy()
this.popperInstance?.destroy()
}

open () {
Expand Down
2 changes: 1 addition & 1 deletion app/components/bali/hover_card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class HovercardController extends Controller {
}

disconnect () {
this.tippy.destroy()
this.tippy?.destroy()
}

onCreate = instance => {
Expand Down
5 changes: 4 additions & 1 deletion app/components/bali/navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export class NavbarController extends Controller {
if (!this.altMenuActive) {
this.element.classList.toggle('is-active')
}
this.menuTarget.classList.toggle('is-active')

if (this.hasMenuTarget) {
this.menuTarget.classList.toggle('is-active')
}

if (this.hasBurgerTarget) {
this.burgerTarget.classList.toggle('is-active')
Expand Down
2 changes: 1 addition & 1 deletion app/components/bali/rich_text_editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class RichTextEditorController extends Controller {
}

disconnect () {
this.editor.destroy()
this.editor?.destroy()
}

onUpdate = ({ editor }) => {
Expand Down
9 changes: 7 additions & 2 deletions app/components/bali/side_menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ export class SideMenuController extends Controller {

toggleMenu (e) {
e.stopPropagation()
this.containerTarget.classList.toggle('is-active')

if (this.hasContainerTarget) {
this.containerTarget.classList.toggle('is-active')
}
}

closeMenu = e => {
this.containerTarget.classList.remove('is-active')
if (this.hasContainerTarget) {
this.containerTarget.classList.remove('is-active')
}
}
}
2 changes: 1 addition & 1 deletion lib/bali/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Bali
VERSION = '1.2.1'
VERSION = '1.2.2'
end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bali-view-components",
"version": "1.2.1",
"version": "1.2.2",
"description": "Bali ViewComponents",
"repository": "[email protected]:Grupo-AFAL/bali.git",
"author": "Federico Gonzalez <[email protected]>",
Expand Down

0 comments on commit 1d4039d

Please sign in to comment.