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

select and drop down don't tree-shake igxForOf #13677

Closed
Tracked by #13562
damyanpetev opened this issue Nov 13, 2023 · 0 comments · Fixed by #13681
Closed
Tracked by #13562

select and drop down don't tree-shake igxForOf #13677

damyanpetev opened this issue Nov 13, 2023 · 0 comments · Fixed by #13681
Assignees
Labels
🐛 bug Any issue that describes a bug dropdown optimization select Select component version: 17.0.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.

Comments

@damyanpetev
Copy link
Member

damyanpetev commented Nov 13, 2023

Description

The Select and Dropdown components use declarative items that are normally iterated. The Dropdown optionally support those items to be iterated using the igxFor directive to create a virtualized dropdown items list - for that reason it references directly the IgxForOfDirective to react if it's used and that prevents it from being tree-shaken out even when it's not needed. The Select component by extending the Dropdown inherits the same issue.

Steps to reproduce

  1. Create an app with just a dropdown or select component
    For example in the bundle-test project in the repo:
    image
  2. Build the app
  3. Run source-map-explorer on the produced main chunk and inspect the result

Result

image

Expected result

The igxFor directive and supporting classes should not be included () in the resulting build bundle.
The components should reference the directive using a lightweight injection token (https://angular.io/guide/lightweight-injection-tokens) to allow it to be tree-shaken.

@damyanpetev damyanpetev self-assigned this Nov 13, 2023
@damyanpetev damyanpetev added dropdown select Select component optimization version: 17.0.x 🐛 bug Any issue that describes a bug 🛠️ status: in-development Issues and PRs with active development on them and removed 🆕 status: new labels Nov 13, 2023
@damyanpetev damyanpetev added ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. and removed 🛠️ status: in-development Issues and PRs with active development on them labels Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Any issue that describes a bug dropdown optimization select Select component version: 17.0.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant