Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(manager): remove duplicate lit module #2334

Merged
merged 10 commits into from
Jan 24, 2025

Conversation

daniellacosse
Copy link
Contributor

@daniellacosse daniellacosse commented Jan 16, 2025

current findings:

  1. tried all the stuff in https://lit.dev/docs/tools/development/, didn't work for getting rid of the multiple dependencies, but gave useful context.
  2. Then I had the idea to use npm's override feature instead - at first to force all our dependencies to use lit@3 and @lit/[email protected]. This didn't work as npm can't force versions upon dependencies that those dependencies don't accept:
Screenshot 2025-01-17 at 3 13 24 PM
  1. Then I tried using override to enforce [email protected] instead, as it seemed that was the version all our dependencies would accept:
Screenshot 2025-01-17 at 3 23 43 PM

As you can see, this successfully removed the multiple versions of lit warning from the tests!

  1. However, the app broke. The "new key" dialog freezes when you edit it, similar to how the rename dialog did before we used the mwc component as a workaround. This further lends credence to the idea that @material/web (the more modern md prefixed web components) don't play well with the older lit versions and that upgrading to 3 will ultimately fix this issue.

At this point, I think our only option is to use Webpack to force resolution of lit throughout our build (something I was trying to avoid):

const path = require('path');

module.exports = {
  // ... other webpack configurations
  resolve: {
    alias: {
      // This will make sure that any dependency that imports 'lit' or any of its sub-modules
      // will use the version you installed in step 1
      lit: path.resolve(__dirname, 'node_modules/lit'),
      'lit/*': path.resolve(__dirname, 'node_modules/lit/*'),
    },
  },
};

This is a little tricky given our monorepo structure, but doable.

Out of scope would be to switch back to yarn, as yarn 2+ has really precise controls for managing the dependencies of your dependencies.

Also, we should probably let the lit team (?) know about the overrides trick I discovered? That way they can update their documentation to be more helpful.

@daniellacosse daniellacosse force-pushed the daniellacosse/dedupe_lit branch from 2a00ad0 to 7fe1874 Compare January 17, 2025 19:44
@daniellacosse
Copy link
Contributor Author

The webpack method worked! Now I just need to clean this up a little bit.

@daniellacosse daniellacosse marked this pull request as ready for review January 21, 2025 22:25
@daniellacosse daniellacosse requested review from a team as code owners January 21, 2025 22:25
@daniellacosse daniellacosse requested a review from fortuna January 22, 2025 15:11
@daniellacosse
Copy link
Contributor Author

Unfortunately, I tried upgrading the mwc-textfield and it still remains uneditable in the iOS 15.5 simulator. I'll try again tomorrow on a real device once I'm in the office. Here's the diff:

diff --git a/client/src/www/views/servers_view/server_list_item/server_card/server_rename_dialog/index.ts b/client/src/www/views/servers_view/server_list_item/server_card/server_rename_dialog/index.ts
index cb4f64f2..e624608c 100644
--- a/client/src/www/views/servers_view/server_list_item/server_card/server_rename_dialog/index.ts
+++ b/client/src/www/views/servers_view/server_list_item/server_card/server_rename_dialog/index.ts
@@ -60,14 +60,14 @@ export class ServerRenameDialog extends LitElement {
           On older versions of iOS, md-textfield triggers itself indefinitely here,
           so we must use mwc-textfield
         -->
-        <mwc-textfield
+        <md-filled-text-field
           slot="content"
           maxLength="100"
           value="${this.internalServerName}"
           @input=${(e: Event) => {
             this.internalServerName = (e.target as HTMLInputElement).value;
           }}
-        ></mwc-textfield>
+        ></md-filled-text-field>
         <fieldset slot="actions">
           <md-text-button @click=${this.handleClose}
             >${this.localize('cancel')}</md-text-button

@daniellacosse daniellacosse requested a review from sbruens January 22, 2025 21:03
Copy link
Contributor

@sbruens sbruens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM assuming this works

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@daniellacosse daniellacosse requested a review from fortuna January 23, 2025 16:31
@daniellacosse
Copy link
Contributor Author

LGTM assuming this works

So on my iOS 15.5 device using the md-filled-text-field is... now slightly better? Nothing freezes, but you have to tap the input a ton of times and then you can do one keystroke :/

@fortuna fortuna removed their request for review January 23, 2025 21:57
@daniellacosse daniellacosse enabled auto-merge (squash) January 24, 2025 15:36
@daniellacosse daniellacosse merged commit a6c43ca into master Jan 24, 2025
25 checks passed
@daniellacosse daniellacosse deleted the daniellacosse/dedupe_lit branch January 24, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants