Skip to content

Commit

Permalink
fix(snackbar): open snackbar when created programatically
Browse files Browse the repository at this point in the history
The snackbar would not open if an HTML element was created and added to the DOM programatically
  • Loading branch information
jgroth authored and adrianschmidt committed Sep 3, 2024
1 parent 9bd19ef commit 824e29c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/snackbar/snackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,20 @@ export class Snackbar {

private snackbarId: string;
private timeoutId?: number;
private firstRender = true;

public constructor() {
this.snackbarId = createRandomString();
}

public componentWillLoad() {
this.isOpen = this.open;
public componentDidRender() {
if (!this.firstRender) {
return;
}

this.firstRender = false;

requestAnimationFrame(() => this.watchOpen());
}

@Listen('changeOffset')
Expand Down

0 comments on commit 824e29c

Please sign in to comment.