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

External loading anand #2575

Draft
wants to merge 2 commits into
base: feat-provide-external-loading-triggers
Choose a base branch
from

Conversation

anandtiwary
Copy link
Contributor

Description

Please include a summary of the change, motivation and context.

Testing

Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally.

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

Documentation

Make sure that you have documented corresponding changes in this repository or hypertrace docs repo if required.

Copy link

Test Results

       4 files  ±0     316 suites  ±0   31m 49s ⏱️ -20s
1 135 tests ±0  1 135 ✔️ ±0  0 💤 ±0  0 ±0 
1 145 runs  ±0  1 145 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 50bf809. ± Comparison against base commit 9967e6f.

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (9b209ac) 82.20% compared to head (50bf809) 82.17%.
Report is 1 commits behind head on feat-provide-external-loading-triggers.

Files Patch % Lines
...components/src/table/data/table-cdk-data-source.ts 93.75% 1 Missing ⚠️
Additional details and impacted files
@@                            Coverage Diff                             @@
##           feat-provide-external-loading-triggers    #2575      +/-   ##
==========================================================================
- Coverage                                   82.20%   82.17%   -0.03%     
==========================================================================
  Files                                         927      927              
  Lines                                       20879    20882       +3     
  Branches                                     3316     3319       +3     
==========================================================================
- Hits                                        17163    17160       -3     
- Misses                                       3579     3584       +5     
- Partials                                      137      138       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

export interface TableDataSource<TResult, TCol extends TableColumnConfig = TableColumnConfig> {
getData(request: TableDataRequest<TCol>): Observable<TableDataResponse<TResult>>;
export interface TableDataSource<TResult, TCol extends TableColumnConfig = TableColumnConfig, TDataTriggers = unknown> {
secondaryDataTriggers$?: Observable<TDataTriggers>; // TBD
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, this is fine how it is used here. Adding it to watched observables in the data source is sound logic. However, does it give us the intended effect. Do we show a loader while the new data is being resolved?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

secondaryDataTriggers$?: Observable<TDataTriggers>; // TBD
getData(
request: TableDataRequest<TCol>,
secondaryDataTriggers?: TDataTriggers,
Copy link
Contributor

Choose a reason for hiding this comment

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

we should be able to avoid this by making new request happen on a trigger change within the table. Is that something we can do? Getting the triggers as part of data source and then the consumer having to implement some logic dependent on them seems wierd.

We should not have to emit filters via these triggers again. These triggers can play the simple role of being signals while the getData method's request argument having the desired state always.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we should be able to avoid this by making new request happen on a trigger change within the table

This is exactly what we are doing. For requests triggered externally, we do need some state (e.g show inactive boolean). The purpose of this argument is to pass on that state to the getData method so that it can be used to build the correct gql query.

]).pipe(map(values => this.detectRowStateChanges(...values)));
]).pipe(
switchMap(values =>
combineLatest([of(values), this.tableDataSourceProvider.data?.secondaryDataTriggers$ ?? of(undefined)]),
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are using combineLatest, in terms of emitting the loading state value, it will have affect the same way as 2 subscriptions, one to the existing change observable and one to secondaryDataTriggers$.

Correct me if I am wrong.

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.

None yet

3 participants