Skip to content

Commit 6caea40

Browse files
authored
Frontend browser profile UI enhancements origin check fix (#3030)
- Fix for 'Create Profile' button sometimes not being enabled due to event not firing, see: #3024 (comment) - Ensure that if origins are loaded before browser is ready, both are checked separately.
1 parent 8ada243 commit 6caea40

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

frontend/src/features/browser-profiles/profile-browser-dialog.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ enum BrowserStatus {
2929
Initial,
3030
Pending,
3131
Ready,
32-
Complete,
3332
Error,
3433
}
3534

@@ -54,6 +53,9 @@ export class ProfileBrowserDialog extends BtrixElement {
5453
@state()
5554
private browserStatus = BrowserStatus.Initial;
5655

56+
@state()
57+
private originsLoaded = false;
58+
5759
@state()
5860
private showConfirmation = false;
5961

@@ -151,7 +153,8 @@ export class ProfileBrowserDialog extends BtrixElement {
151153
render() {
152154
const isCrawler = this.appState.isCrawler;
153155
const creatingNew = this.duplicating || !this.profile;
154-
const incomplete = this.browserStatus !== BrowserStatus.Complete;
156+
const incomplete =
157+
!this.originsLoaded || this.browserStatus !== BrowserStatus.Ready;
155158
const saving = this.saveProfileTask.status === TaskStatus.PENDING;
156159

157160
return html`<btrix-dialog
@@ -341,7 +344,7 @@ export class ProfileBrowserDialog extends BtrixElement {
341344
e: CustomEvent<BrowserOriginsChange>,
342345
) => {
343346
if (e.detail.origins.length) {
344-
this.browserStatus = BrowserStatus.Complete;
347+
this.originsLoaded = true;
345348
}
346349
};
347350

frontend/src/features/browser-profiles/profile-browser.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,7 @@ export class ProfileBrowser extends BtrixElement {
173173
try {
174174
const { origins } = await this.pingBrowser(browser.id, signal);
175175

176-
if (
177-
this.originsTask.value &&
178-
origins &&
179-
isNotEqual(this.originsTask.value, origins)
180-
) {
176+
if (origins && isNotEqual(this.originsTask.value, origins)) {
181177
this.dispatchEvent(
182178
new CustomEvent<BrowserOriginsChange>(
183179
"btrix-browser-origins-change",

0 commit comments

Comments
 (0)