profile-picker UI: Migrate to Lit, part 3. [chromium/src : main]

1 view
Skip to first unread message

Teresa Mao (Gerrit)

unread,
Jul 25, 2024, 7:08:18 PM (2 days ago) Jul 25
to findit...@appspot.gserviceaccount.com, Demetrios Papadopoulos, Chromium LUCI CQ, chromium...@chromium.org, Daniel Cheng, blundell+...@chromium.org
Attention needed from Demetrios Papadopoulos

Teresa Mao added 6 comments

File chrome/browser/resources/signin/profile_picker/navigation_mixin_lit.ts
Line 154, Patchset 2:const routeObservers: Set<NavigationMixinInterface> = new Set();
Demetrios Papadopoulos . resolved

This needs to be shared across Lit and Polymer versions of the mixin.

Teresa Mao

This is what causes the add profile button issue. Thanks.

File chrome/browser/resources/signin/profile_picker/profile_picker_main_view.ts
Line 81, Patchset 1: protected hideAskOnStartup_: boolean = true;
Demetrios Papadopoulos . unresolved

Should this be initialized to false?

Teresa Mao

It was initialized to true to match the default value in the Polymer version. See line 76 in the original file.

Line 102, Patchset 1: this.askOnStartup_ = loadTimeData.getBoolean('askOnStartup');
Demetrios Papadopoulos . resolved

Merge with line 82 and remove the constructor?

Teresa Mao

Done

Line 147, Patchset 1: this.updateComplete.then(() => {
Demetrios Papadopoulos . resolved

Using the `updateComplete` promise within the `updated()` callback should not be necessary. Is thi sneeded?

Teresa Mao

Done

Line 237, Patchset 1: navigateTo(Routes.NEW_PROFILE);
Teresa Mao . resolved

@dpa...@chromium.org I need help with debugging the "Add" profile button not being responsible when clicked.

Steps to reproduce:

  • Go to chrome://profile-picker.
  • Click the "Add" button next to the existing profile.

Expected: It should route to chrome://profile-picker/new-profile.

Actual: No visual changes.

What I know so far:

  • `onAddProfileClick_()` is called which is triggered by button clicked.
  • `navigateTo()` from navigation_mixin_lit.ts is reached.
  • The call to notify routeObservers on line 161 of navigation_mixin_lit.ts is reached.
  • `onRouteChange()` on line 161 of profile_picker_main_view.ts is reached, but no further action occurs.
Demetrios Papadopoulos

I haven't had a chance to patch this CL locally yet. Will update once I have any findings.

Demetrios Papadopoulos

Does the code at https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/resources/signin/profile_picker/profile_picker_app.ts;l=90;drc=3f4203f7dca2f7e804f30cfa783e24f90acd9059 execute? If not, that would be why there is nothing happening. See other related comment.

Teresa Mao

No, as it was pointed out in the other comment, profile-picker-app extends a different NavigationMixin class compared to profile-picker-main-view. This is why a `routeObservers` in one NavigationMixin class cannot notify the observers in the other class.

Line 252, Patchset 1: this.profilesList_ = [
...this.profilesList_.slice(0, index),
...this.profilesList_.slice(index + 1),
];
Demetrios Papadopoulos . unresolved

Unnecessary calculations? Does the following not work equivalently?

```suggestion
this.profilesList_.splice(i, 1);
this.requestUpdate();
```
Teresa Mao

If I do `this.profilesList_.splice(i, 1);`, Lit will not capture `profilesList_` in `changedProperties` in life cycle methods such as `willUpdate()`, and the computations depending on `profilesList_` will not be executed. To ensure Lit detects the change, I need to explicitly assign a new value to `profilesList_`.

To make your suggestion work, I will need to remove the if check around computations depending on `profilesList_`.

Open in Gerrit

Related details

Attention is currently required from:
  • Demetrios Papadopoulos
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ic7938cb1a906cac9e5173b23a4186f4c9c941cf3
Gerrit-Change-Number: 5736810
Gerrit-PatchSet: 4
Gerrit-Owner: Teresa Mao <te...@chromium.org>
Gerrit-Reviewer: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Reviewer: Teresa Mao <te...@chromium.org>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Comment-Date: Thu, 25 Jul 2024 23:08:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Demetrios Papadopoulos <dpa...@chromium.org>
Comment-In-Reply-To: Teresa Mao <te...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Demetrios Papadopoulos (Gerrit)

unread,
Jul 25, 2024, 7:41:54 PM (2 days ago) Jul 25
to Teresa Mao, David Roger, Alex Ilin, Monica Basta, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Daniel Cheng, blundell+...@chromium.org
Attention needed from Teresa Mao

Demetrios Papadopoulos added 11 comments

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Demetrios Papadopoulos . unresolved

cc'ing a few more specific owners.

@temao: Were you able to locally verify the drag and drop behavior?

@owners: Is ProfilesReordering still relevant? The feature is DISABLED_BY_DEFAULT. Should this code be removed?

File chrome/browser/resources/signin/profile_picker/drag_drop_reorder_tile_list_delegate.ts
Line 67, Patchset 4 (Latest): private titleList_: Object[];
Demetrios Papadopoulos . unresolved

What's the actual type of this? Can we use a more accurate type here?

Line 89, Patchset 4 (Latest): this.litElement_ = litElement;
Demetrios Papadopoulos . unresolved

Let's rename to just `element`? I don't think adding 'polymer' or 'lit' in the name is very beneficial here.

Line 92, Patchset 4 (Latest): this.tileListName_ = tileListName;
Demetrios Papadopoulos . unresolved

Is this still used anywhere?

File chrome/browser/resources/signin/profile_picker/navigation_mixin.ts
Line 240, Patchset 4 (Latest):export const NavigationMixinLit = dedupingMixin(
Demetrios Papadopoulos . unresolved

dedupingMixin shouldn't be used with the Lit version, no?

File chrome/browser/resources/signin/profile_picker/profile_picker_main_view.html
Line 17, Patchset 4 (Latest): `)}
Demetrios Papadopoulos . unresolved

Remove trailing spaces.

File chrome/browser/resources/signin/profile_picker/profile_picker_main_view.ts
Line 238, Patchset 4 (Latest): if (index !== -1) {
Demetrios Papadopoulos . unresolved

Can this ever be -1? Should this be an assertion instead?

Line 246, Patchset 4 (Latest): this.initializeDragDelegate_();
Demetrios Papadopoulos . unresolved

Since we are already calling this on `updated()` we shouldn't have to call it here, no?

Line 250, Patchset 4 (Latest): return !isAskOnStartupAllowed() || !this.profilesList_ ||
Demetrios Papadopoulos . unresolved

Can this ever be true? If not let's remove.

Line 252, Patchset 1: this.profilesList_ = [
...this.profilesList_.slice(0, index),
...this.profilesList_.slice(index + 1),
];
Demetrios Papadopoulos . unresolved

Unnecessary calculations? Does the following not work equivalently?

```suggestion
this.profilesList_.splice(i, 1);
this.requestUpdate();
```
Teresa Mao

If I do `this.profilesList_.splice(i, 1);`, Lit will not capture `profilesList_` in `changedProperties` in life cycle methods such as `willUpdate()`, and the computations depending on `profilesList_` will not be executed. To ensure Lit detects the change, I need to explicitly assign a new value to `profilesList_`.

To make your suggestion work, I will need to remove the if check around computations depending on `profilesList_`.

Demetrios Papadopoulos
 I will need to remove the if check around computations depending on profilesList_.

Let's do this instead. For trivial (cheap) updates we don't necessarily have to use changeProperties to trigger them.

Line 271, Patchset 4 (Latest): return this.shadowRoot!.querySelector<HTMLElement>('#profile-' + index)!;
Demetrios Papadopoulos . unresolved

Since we now attach a data-index attribute to each element, can this be changed as follows?

profilesContainer

```suggestion
return this.shadowRoot!.querySelector<HTMLElement>('profile-card[data-index="${index}"]'!;
```

And remove the ID from the template?

Open in Gerrit

Related details

Attention is currently required from:
  • Teresa Mao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ic7938cb1a906cac9e5173b23a4186f4c9c941cf3
Gerrit-Change-Number: 5736810
Gerrit-PatchSet: 4
Gerrit-Owner: Teresa Mao <te...@chromium.org>
Gerrit-Reviewer: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Reviewer: Teresa Mao <te...@chromium.org>
Gerrit-CC: Alex Ilin <alex...@chromium.org>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: David Roger <dro...@chromium.org>
Gerrit-CC: Monica Basta <msa...@chromium.org>
Gerrit-Attention: Teresa Mao <te...@chromium.org>
Gerrit-Comment-Date: Thu, 25 Jul 2024 23:41:43 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Demetrios Papadopoulos (Gerrit)

unread,
Jul 25, 2024, 7:44:16 PM (2 days ago) Jul 25
to Teresa Mao, David Roger, Alex Ilin, Monica Basta, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Daniel Cheng, blundell+...@chromium.org
Attention needed from Teresa Mao

Demetrios Papadopoulos added 1 comment

File chrome/browser/resources/signin/profile_picker/profile_picker_main_view.ts
Line 81, Patchset 1: protected hideAskOnStartup_: boolean = true;
Demetrios Papadopoulos . unresolved

Should this be initialized to false?

Teresa Mao

It was initialized to true to match the default value in the Polymer version. See line 76 in the original file.

Demetrios Papadopoulos

The initial value here is overwritten in the first willUpdate() call before the element has rendered, so I don't think the 'true' value here makes any difference. Even in the Polymer version, computed properties default value does not make a lot of sense

Gerrit-Comment-Date: Thu, 25 Jul 2024 23:44:04 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Monica Basta (Gerrit)

unread,
Jul 26, 2024, 4:18:12 AM (yesterday) Jul 26
to Teresa Mao, Ryan Sultanem, David Roger, Alex Ilin, findit...@appspot.gserviceaccount.com, Demetrios Papadopoulos, Chromium LUCI CQ, chromium...@chromium.org, Daniel Cheng, blundell+...@chromium.org
Attention needed from Demetrios Papadopoulos, Ryan Sultanem and Teresa Mao

Monica Basta added 1 comment

Patchset-level comments
Demetrios Papadopoulos . unresolved

cc'ing a few more specific owners.

@temao: Were you able to locally verify the drag and drop behavior?

@owners: Is ProfilesReordering still relevant? The feature is DISABLED_BY_DEFAULT. Should this code be removed?

Monica Basta

@rs...@google.com can you give more context about the launch state for `ProfilesReordering`? If I am not mistaken there are few corner cases that need to fixed before the launch but the team is focused on other priorities

Open in Gerrit

Related details

Attention is currently required from:
  • Demetrios Papadopoulos
  • Ryan Sultanem
  • Teresa Mao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ic7938cb1a906cac9e5173b23a4186f4c9c941cf3
Gerrit-Change-Number: 5736810
Gerrit-PatchSet: 4
Gerrit-Owner: Teresa Mao <te...@chromium.org>
Gerrit-Reviewer: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Reviewer: Teresa Mao <te...@chromium.org>
Gerrit-CC: Alex Ilin <alex...@chromium.org>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: David Roger <dro...@chromium.org>
Gerrit-CC: Monica Basta <msa...@chromium.org>
Gerrit-CC: Ryan Sultanem <rs...@google.com>
Gerrit-Attention: Ryan Sultanem <rs...@google.com>
Gerrit-Attention: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Attention: Teresa Mao <te...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Jul 2024 08:17:58 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

David Roger (Gerrit)

unread,
Jul 26, 2024, 4:32:51 AM (yesterday) Jul 26
to Teresa Mao, Ryan Sultanem, Alex Ilin, Monica Basta, findit...@appspot.gserviceaccount.com, Demetrios Papadopoulos, Chromium LUCI CQ, chromium...@chromium.org, Daniel Cheng, blundell+...@chromium.org
Attention needed from Demetrios Papadopoulos, Monica Basta, Ryan Sultanem and Teresa Mao

David Roger added 1 comment

Patchset-level comments
Demetrios Papadopoulos . unresolved

cc'ing a few more specific owners.

@temao: Were you able to locally verify the drag and drop behavior?

@owners: Is ProfilesReordering still relevant? The feature is DISABLED_BY_DEFAULT. Should this code be removed?

Monica Basta

@rs...@google.com can you give more context about the launch state for `ProfilesReordering`? If I am not mistaken there are few corner cases that need to fixed before the launch but the team is focused on other priorities

David Roger

We should keep this feature. We have active plans to launch it. I think the flag just expired, but we should re-enable it.

Open in Gerrit

Related details

Attention is currently required from:
  • Demetrios Papadopoulos
  • Monica Basta
  • Ryan Sultanem
  • Teresa Mao
Gerrit-Attention: Monica Basta <msa...@chromium.org>
Gerrit-Attention: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Attention: Teresa Mao <te...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Jul 2024 08:32:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Monica Basta <msa...@chromium.org>
Comment-In-Reply-To: Demetrios Papadopoulos <dpa...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ryan Sultanem (Gerrit)

unread,
Jul 26, 2024, 4:49:38 AM (yesterday) Jul 26
to Teresa Mao, David Roger, Alex Ilin, Monica Basta, findit...@appspot.gserviceaccount.com, Demetrios Papadopoulos, Chromium LUCI CQ, chromium...@chromium.org, Daniel Cheng, blundell+...@chromium.org
Attention needed from David Roger, Demetrios Papadopoulos, Monica Basta and Teresa Mao

Ryan Sultanem added 1 comment

Patchset-level comments
Demetrios Papadopoulos . unresolved

cc'ing a few more specific owners.

@temao: Were you able to locally verify the drag and drop behavior?

@owners: Is ProfilesReordering still relevant? The feature is DISABLED_BY_DEFAULT. Should this code be removed?

Monica Basta

@rs...@google.com can you give more context about the launch state for `ProfilesReordering`? If I am not mistaken there are few corner cases that need to fixed before the launch but the team is focused on other priorities

David Roger

We should keep this feature. We have active plans to launch it. I think the flag just expired, but we should re-enable it.

Ryan Sultanem

Indeed the feature is still relevant.
The feature launch was started, but then after finding some minor bugs (that needs fixing) and attempting to explore more ways to make the feature discoverable, we decided to leave it for later.
However the team got other priorities in the meantime which delayed the updates to the feature even more.
I have recently started looking into more and it should be completed and revived very soon.

Open in Gerrit

Related details

Attention is currently required from:
  • David Roger
  • Demetrios Papadopoulos
  • Monica Basta
  • Teresa Mao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ic7938cb1a906cac9e5173b23a4186f4c9c941cf3
Gerrit-Change-Number: 5736810
Gerrit-PatchSet: 4
Gerrit-Owner: Teresa Mao <te...@chromium.org>
Gerrit-Reviewer: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Reviewer: Teresa Mao <te...@chromium.org>
Gerrit-CC: Alex Ilin <alex...@chromium.org>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: David Roger <dro...@chromium.org>
Gerrit-CC: Monica Basta <msa...@chromium.org>
Gerrit-CC: Ryan Sultanem <rs...@google.com>
Gerrit-Attention: Monica Basta <msa...@chromium.org>
Gerrit-Attention: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Attention: David Roger <dro...@chromium.org>
Gerrit-Attention: Teresa Mao <te...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Jul 2024 08:49:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Monica Basta <msa...@chromium.org>
Comment-In-Reply-To: Demetrios Papadopoulos <dpa...@chromium.org>
Comment-In-Reply-To: David Roger <dro...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

findit-for-me@appspot.gserviceaccount.com (Gerrit)

unread,
Jul 26, 2024, 8:14:57 PM (12 hours ago) Jul 26
to Teresa Mao, Ryan Sultanem, David Roger, Alex Ilin, Monica Basta, Demetrios Papadopoulos, Chromium LUCI CQ, chromium...@chromium.org, Daniel Cheng, blundell+...@chromium.org
Attention needed from Demetrios Papadopoulos, Monica Basta and Teresa Mao

findit...@appspot.gserviceaccount.com voted Code-Coverage+1

This change meets the code coverage requirements.

Code-Coverage+1
Open in Gerrit

Related details

Attention is currently required from:
  • Demetrios Papadopoulos
  • Monica Basta
  • Teresa Mao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ic7938cb1a906cac9e5173b23a4186f4c9c941cf3
Gerrit-Change-Number: 5736810
Gerrit-PatchSet: 5
Gerrit-Owner: Teresa Mao <te...@chromium.org>
Gerrit-Reviewer: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Reviewer: Teresa Mao <te...@chromium.org>
Gerrit-CC: Alex Ilin <alex...@chromium.org>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: David Roger <dro...@chromium.org>
Gerrit-CC: Monica Basta <msa...@chromium.org>
Gerrit-CC: Ryan Sultanem <rs...@google.com>
Gerrit-Attention: Monica Basta <msa...@chromium.org>
Gerrit-Attention: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Attention: Teresa Mao <te...@chromium.org>
Gerrit-Comment-Date: Sat, 27 Jul 2024 00:14:43 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Teresa Mao (Gerrit)

unread,
3:09 AM (5 hours ago) 3:09 AM
to Ryan Sultanem, David Roger, Alex Ilin, Monica Basta, findit...@appspot.gserviceaccount.com, Demetrios Papadopoulos, Chromium LUCI CQ, chromium...@chromium.org, Daniel Cheng, blundell+...@chromium.org
Attention needed from Demetrios Papadopoulos

Teresa Mao added 12 comments

Patchset-level comments
Demetrios Papadopoulos . unresolved

cc'ing a few more specific owners.

@temao: Were you able to locally verify the drag and drop behavior?

@owners: Is ProfilesReordering still relevant? The feature is DISABLED_BY_DEFAULT. Should this code be removed?

Teresa Mao

@temao: Were you able to locally verify the drag and drop behavior?

I tested drag and drop locally by removing if check in `initializeDragDelegate_()` which gets the value of feature flag `profilesReorderingEnabled` and is disabled by default. All the drag and drop browser tests (ProfilePickerTest.MainView) were run on both windows and lacros, and they all passed.

File chrome/browser/resources/signin/profile_picker/drag_drop_reorder_tile_list_delegate.ts
Line 67, Patchset 4: private titleList_: Object[];
Demetrios Papadopoulos . resolved

What's the actual type of this? Can we use a more accurate type here?

Teresa Mao

Done

Line 89, Patchset 4: this.litElement_ = litElement;
Demetrios Papadopoulos . resolved

Let's rename to just `element`? I don't think adding 'polymer' or 'lit' in the name is very beneficial here.

Teresa Mao

Done

Line 92, Patchset 4: this.tileListName_ = tileListName;
Demetrios Papadopoulos . resolved

Is this still used anywhere?

Teresa Mao

Removed.

File chrome/browser/resources/signin/profile_picker/navigation_mixin.ts
Line 240, Patchset 4:export const NavigationMixinLit = dedupingMixin(
Demetrios Papadopoulos . unresolved

dedupingMixin shouldn't be used with the Lit version, no?

Teresa Mao

Do we have a lit equivalent version of dedupingMixin?

File chrome/browser/resources/signin/profile_picker/profile_picker_main_view.html
Line 17, Patchset 4: `)}
Demetrios Papadopoulos . resolved

Remove trailing spaces.

Teresa Mao

Done

File chrome/browser/resources/signin/profile_picker/profile_picker_main_view.ts
Line 81, Patchset 1: protected hideAskOnStartup_: boolean = true;
Demetrios Papadopoulos . resolved

Should this be initialized to false?

Teresa Mao

It was initialized to true to match the default value in the Polymer version. See line 76 in the original file.

Demetrios Papadopoulos

The initial value here is overwritten in the first willUpdate() call before the element has rendered, so I don't think the 'true' value here makes any difference. Even in the Polymer version, computed properties default value does not make a lot of sense

Teresa Mao

Done

Line 238, Patchset 4: if (index !== -1) {
Demetrios Papadopoulos . resolved

Can this ever be -1? Should this be an assertion instead?

Teresa Mao

Done

Line 246, Patchset 4: this.initializeDragDelegate_();
Demetrios Papadopoulos . unresolved

Since we are already calling this on `updated()` we shouldn't have to call it here, no?

Teresa Mao

If we remove it here, we will need to add a null check on line 105 of drag_drop_reorder_tile_list_delegate.ts. This is because relying on calling initializeDragDelegate_() in updated() will cause the DOM to be out of sync with the data passed in drag_drop_reorder_tile_list_delegate.ts, which will then lead to null exception in line 105 of drag_drop_reorder_tile_list_delegate.ts when it tries to access a tile which has already been removed.

Line 250, Patchset 4: return !isAskOnStartupAllowed() || !this.profilesList_ ||
Demetrios Papadopoulos . resolved

Can this ever be true? If not let's remove.

Teresa Mao

Done

Line 252, Patchset 1: this.profilesList_ = [
...this.profilesList_.slice(0, index),
...this.profilesList_.slice(index + 1),
];
Demetrios Papadopoulos . resolved

Unnecessary calculations? Does the following not work equivalently?

```suggestion
this.profilesList_.splice(i, 1);
this.requestUpdate();
```
Teresa Mao

If I do `this.profilesList_.splice(i, 1);`, Lit will not capture `profilesList_` in `changedProperties` in life cycle methods such as `willUpdate()`, and the computations depending on `profilesList_` will not be executed. To ensure Lit detects the change, I need to explicitly assign a new value to `profilesList_`.

To make your suggestion work, I will need to remove the if check around computations depending on `profilesList_`.

Demetrios Papadopoulos
 I will need to remove the if check around computations depending on profilesList_.

Let's do this instead. For trivial (cheap) updates we don't necessarily have to use changeProperties to trigger them.

Teresa Mao

Done

Line 271, Patchset 4: return this.shadowRoot!.querySelector<HTMLElement>('#profile-' + index)!;
Demetrios Papadopoulos . resolved

Since we now attach a data-index attribute to each element, can this be changed as follows?

profilesContainer

```suggestion
return this.shadowRoot!.querySelector<HTMLElement>('profile-card[data-index="${index}"]'!;
```

And remove the ID from the template?

Teresa Mao

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Demetrios Papadopoulos
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ic7938cb1a906cac9e5173b23a4186f4c9c941cf3
Gerrit-Change-Number: 5736810
Gerrit-PatchSet: 5
Gerrit-Owner: Teresa Mao <te...@chromium.org>
Gerrit-Reviewer: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Reviewer: Teresa Mao <te...@chromium.org>
Gerrit-CC: Alex Ilin <alex...@chromium.org>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: David Roger <dro...@chromium.org>
Gerrit-CC: Monica Basta <msa...@chromium.org>
Gerrit-CC: Ryan Sultanem <rs...@google.com>
Gerrit-Attention: Demetrios Papadopoulos <dpa...@chromium.org>
Gerrit-Comment-Date: Sat, 27 Jul 2024 07:09:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages