Skip to content

Commit

Permalink
Prevent layout items from losing their connection to asigned panel on…
Browse files Browse the repository at this point in the history
… DOM move.
  • Loading branch information
George-Payne committed Nov 12, 2024
1 parent 3ad218b commit 5760869
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-ravens-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eventstore-ui/layout': patch
---

Bug fix: Prevent layout items from losing their connection to asigned panel on DOM move.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export class LayoutButton {

private unbindPanelMode?: () => void;

componentWillLoad() {
connectedCallback() {
this.unbindPanelMode?.();
this.unbindPanelMode = bindPanelDetails(this.host, ({ mode }) => {
this.panelMode = mode;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export class LayoutLink {

private unbindPanelMode?: () => void;

componentWillLoad() {
connectedCallback() {
this.unbindPanelMode?.();
this.unbindPanelMode = bindPanelDetails(this.host, ({ mode }) => {
this.panelMode = mode;
});
Expand Down
5 changes: 3 additions & 2 deletions packages/layout/src/components/es-layout-hr/es-layout-hr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import { bindPanelDetails, type PanelMode } from '../panel';
styleUrl: 'es-layout-hr.css',
shadow: true,
})
export class PageTitle {
export class LayoutHR {
@Element() host!: HTMLEsLayoutSectionElement;

@State() panelMode: PanelMode = 'inline';

private unbindMode?: () => void;

componentWillLoad() {
connectedCallback() {
this.unbindMode?.();
this.unbindMode = bindPanelDetails(this.host, ({ mode }) => {
this.panelMode = mode;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export class LayoutSection {

private unbindPanelDetails?: () => void;

componentWillLoad() {
connectedCallback() {
this.unbindPanelDetails?.();
this.unbindPanelDetails = bindPanelDetails(
this.host,
(PanelDetails) => {
Expand Down

0 comments on commit 5760869

Please sign in to comment.