Skip to content

Conversation

jake-bassett
Copy link
Contributor

Description

Fixes issue with initial checkbox filter not being applied to query due to table being wrapped in TableWidgetViewToggleModel. This is due to the the TableWidgetViewToggleModel requiring a view be set prior to it creating the delegate model.

@jake-bassett jake-bassett requested a review from a team as a code owner January 29, 2021 18:27
@codecov
Copy link

codecov bot commented Jan 29, 2021

Codecov Report

Merging #547 (7248122) into main (de73b05) will decrease coverage by 0.03%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #547      +/-   ##
==========================================
- Coverage   85.61%   85.57%   -0.04%     
==========================================
  Files         759      759              
  Lines       15554    15560       +6     
  Branches     1985     1987       +2     
==========================================
  Hits        13316    13316              
- Misses       2205     2211       +6     
  Partials       33       33              
Impacted Files Coverage Δ
...rd/widgets/table/table-widget-view-toggle.model.ts 20.51% <25.00%> (-3.73%) ⬇️
...d/widgets/table/table-widget-renderer.component.ts 55.55% <100.00%> (ø)

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 de73b05...7248122. Read the comment docs.

@github-actions

This comment has been minimized.

value: viewOption
}));

this.populateStaticControls();
Copy link
Contributor

Choose a reason for hiding this comment

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

this delineation between static and dynamic controls seems like we're embedding too much knowledge of the controls into the renderer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, open to suggestions then. Preferably without going down a rabbit hole. :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

of course, of course. When using on init to set the delegate, does this need go away?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. Not really since there are still some controls that fetch data and some that don't.

We could just always repopulate all controls on fetch so the renderer doesn't have to have knowledge of which filters are static vs dynamic, but that seems worse. Not sure how else to handle this since we kind of mix and match how we provide data to our control filters. I kind of think they should all just use the modelAPI to getData(), even if its just an observable that returns a static list.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could just always repopulate all controls on fetch so the renderer doesn't have to have knowledge of which filters are static vs dynamic, but that seems worse

Worse in that its an extra control render that's not necessary? If it's not noticeable, that seems preferable to me (not sure if that would cause things like losing control state on refresh, though).

I kind of think they should all just use the modelAPI to getData(), even if its just an observable that returns a static list.

Agreed, that way the caller doesn't know/care how the callee is implemented. Is this different than the "repopulate all on fetch" above?

Copy link
Contributor Author

@jake-bassett jake-bassett Jan 29, 2021

Choose a reason for hiding this comment

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

Yeah, okay. I think we agree. The populate on fetch does seem the least bad. I'll make that change.


private populateStaticControls(): void {
/*
* CAUTION: If TableWidgetViewToggleModel is used, this.model is not hydrated until after setView() is called,
Copy link
Contributor

Choose a reason for hiding this comment

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

this.model should always be hydrated (first line of the constructor). It sounds like the issue is the view toggle isn't picking a delegate, by default, and forcing the renderer to do so?

Copy link
Contributor Author

@jake-bassett jake-bassett Jan 29, 2021

Choose a reason for hiding this comment

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

Correct. That's exactly what it is, but not sure how to default one in the model without a constructor or some other lifecycle type method. Just assigning one on the class property doesn't work.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds like a case for ModelOnInit!

Copy link
Contributor Author

@jake-bassett jake-bassett Jan 29, 2021

Choose a reason for hiding this comment

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

Oh, lovely. Didn't know we had that. Looks like the fine gentleman who built the dashboarding system thought of about everything.

Copy link
Contributor

Choose a reason for hiding this comment

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

you'd be amazed by all the cool features we have sitting on a github shelf somewhere 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still waiting for the variable within a variable use case to come in handy.

@github-actions

This comment has been minimized.

@jake-bassett jake-bassett merged commit c795786 into main Jan 30, 2021
@jake-bassett jake-bassett deleted the fix-api-discovery-filter branch January 30, 2021 17:46
@github-actions
Copy link

Unit Test Results

    4 files  ±0  232 suites  ±0   13m 40s ⏱️ +6s
824 tests ±0  824 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
828 runs  ±0  828 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit c795786. ± Comparison against base commit de73b05.

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.

2 participants