Skip to content

v14.1.0

Choose a tag to compare

@github-actions github-actions released this 14 May 23:20

⚠️⚠️⚠️ POTENTIALLY A BREAKING CHANGE! READ BEFORE UPDATE ⚠️⚠️⚠️

If you don't have custom-sidebar v14.0.0 already installed, read the release notes of v14.0.0 because there are breaking changes in this version.

This is minor release. If you are already in v14.0.0, this is not a breaking change for you. This release brings several improvements in reliability and performance as well as new features.

Refactor the logic to set the sidebar mode

The logic to set the sidebar mode has been refactored to use an event based set up (the same that Home Assistant performs) instead of changing the values in localStorage. This refactors makes the sidebar mode change more reliable and aligned in how it is performed in Home Assistant.

Refactor custom-sidebar code to make it more reliable

In this relase the custom-sidebar logic has been refactored to make it more reliable even in very slow network conditions. Previously, as the plugin was executed immediately after load, it was possible that the plugin failed because Home Assistant was not ready and in a loading state.

At the moment, only the configuration is loaded from the beginning, but the plugin is not executed until Home Assistant is loaded and the DOM is ready to be queried. To achieve this, multiple checks have been placed to detect when the main elements are added or removed from the DOM.

Throw query selector errors when the debug mode is enabled

If a DOM query fails, it is silently ignored and unless the code tries to call some methods or properties in the queried elements, this is not noticed and this is something that makes it harder to debug if someone reports a bug that is provoked by this. From now on, when the debug mode is enabled (adding the cs_debug parameter in the URL) the promises that are set up to query the DOM elements will reject and throw instead of just silently failing. This will make it easier to debug issues with the plugin related to DOM queries.

Added a new method to the JavaScript templates

From now on, a new method will be available in the JavaScript templates to trigger custom events in Home Assistant.

fireEvent

This method allows one to trigger custom events from specific DOM elements. If no element is provided, it will be triggered from the home-assistant element.

// Fire the uix clear_cache option from the document element
fireEvent(
  document,
  'll-custom',
  {
    uix: {
      action: 'clear_cache'
    }
  }
);

// Fire an event from the home-assistant element
// If the element node is not specified, it will be triggered from the home-assistant element
fireEvent(
  'hass-dock-sidebar',
  {
    dock: 'always_hidden'
  }
);

// Fire an event from the home-assistant element without any detail
fireEvent('my-custom-event');

🚀 Features

  • Throw errors when elements are not found in debug mode
  • Add a fireEvent method to JavaScript templates

🧩 Dependencies

⚙️ Configuration

  • Git ignoreDeprecations to the tsconfig of Docusaurus

📝 Documentation

  • Throw errors when elements are not found in debug mode

📦 Other