Skip to content

Conversation

@arjunlalb
Copy link
Contributor

Description

This PR -> #969 introduced a change where the common project depends on components project. That should not happen. Refactoring code to avoid that unintended dependency.

Testing

Verified with build.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@arjunlalb arjunlalb requested a review from a team as a code owner November 13, 2021 02:51
@codecov
Copy link

codecov bot commented Nov 13, 2021

Codecov Report

Merging #1258 (70a697a) into main (b1d8250) will decrease coverage by 11.51%.
The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1258       +/-   ##
===========================================
- Coverage   84.73%   73.22%   -11.52%     
===========================================
  Files         835      836        +1     
  Lines       17416    17477       +61     
  Branches     2288     2305       +17     
===========================================
- Hits        14758    12797     -1961     
- Misses       2624     4639     +2015     
- Partials       34       41        +7     
Impacted Files Coverage Δ
...ojects/common/src/navigation/navigation.service.ts 86.46% <ø> (-1.13%) ⬇️
...ents/src/navigation/nav-item/nav-item.component.ts 75.00% <ø> (-25.00%) ⬇️
src/app/shared/navigation/navigation.component.ts 0.00% <0.00%> (-100.00%) ⬇️
...mponents/src/navigation/navigation-list.service.ts 25.00% <25.00%> (ø)
projects/common/src/public-api.ts 100.00% <100.00%> (ø)
...rc/navigation/navigation-list-component.service.ts 21.42% <100.00%> (-78.58%) ⬇️
...onents/src/navigation/navigation-list.component.ts 37.93% <100.00%> (-48.28%) ⬇️
projects/components/src/public-api.ts 100.00% <100.00%> (ø)
src/app/home/home.module.ts 0.00% <0.00%> (-100.00%) ⬇️
src/app/home/home.component.ts 0.00% <0.00%> (-100.00%) ⬇️
... and 234 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1d8250...70a697a. Read the comment docs.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

import { IconType } from '@hypertrace/assets-library';
import { APP_TITLE } from '@hypertrace/common';
import { NavItemType } from '@hypertrace/components';
import { APP_TITLE, NavItemType } from '@hypertrace/common';
Copy link
Contributor

Choose a reason for hiding this comment

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

circular ref, we're in the common project here

import { isEqualIgnoreFunctions, throwIfNil } from '../utilities/lang/lang-utils';
import { Dictionary } from '../utilities/types/types';
import { APP_TITLE, HtRoute } from './ht-route';
import { NavItemConfig, NavItemType } from './navigation.config';
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO the better solution would be to move the method out of nav service into the nav component - that's the only caller and would allow leaving icon size on the config as is, too - but up to you.

Copy link
Contributor

@anandtiwary anandtiwary Nov 14, 2021

Choose a reason for hiding this comment

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

I was actually trying to fix this too as part of nx poc work. I think we should remove the decorateNavItem method from here and move it to a new service -> navigation-list.service.ts. This method is only used when we are using the navigation-list.component.

We can move it to the component too like Aaron is suggesting but that may require some additional work.

type: NavItemType.Link;
icon: string;
iconSize?: IconSize;
iconSize?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should remove this type safety. We only support few size options. Moving the method to a new service would solve this.

@github-actions
Copy link

Unit Test Results

    4 files  ±  0  269 suites   - 3   15m 51s ⏱️ - 4m 2s
962 tests  - 12  962 ✔️  - 12  0 💤 ±0  0 ❌ ±0 
969 runs   - 12  969 ✔️  - 12  0 💤 ±0  0 ❌ ±0 

Results for commit 70a697a. ± Comparison against base commit b1d8250.

@arjunlalb arjunlalb closed this Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants