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

Remove type any from return value of getContainingView, getSession #3959

Merged
merged 3 commits into from Oct 3, 2023

Conversation

cmdcolin
Copy link
Collaborator

@cmdcolin cmdcolin commented Oct 3, 2023

Currently the objects returned by getSession, getContainingView, and others are essentially type any because they are e.g. an AbstractSessionModel & IAnyStateTreeModel

By mixing (&'ing) with IAnyStateTreeModel, the whole thing is any

This removes the & IAnyStateTreeModel, and then cleans up some usage of these functions in the code including type guards, adding more stuff to the abstract model, etc.

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Oct 3, 2023
@cmdcolin
Copy link
Collaborator Author

cmdcolin commented Oct 3, 2023

I also tried to move towards using focusedViewId rather than focusedView in some places

This PR originally was started because embedded code was calling setFocusedViewId when selecting a feature, but this was a crash on embedded

Technically embedded should probably say it is 'always focused' to enable embedded to have keyboard shortcuts but thats not done here yet

@cmdcolin cmdcolin removed the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Oct 3, 2023
/**
* #action
*/
activateConfigurationUI() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

appeared unused, I think the behavior is wrong also (getting return value of editTrackConfiguration and then hiding/showing...)

@@ -1141,6 +1141,7 @@ export function getTickDisplayStr(totalBp: number, bpPerPx: number) {
}

export function getViewParams(model: IAnyStateTreeNode, exportSVG?: boolean) {
// @ts-expect-error
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should probably move to @jbrowse/plugin-linear-genome-view

isSessionModelWithWidgets(session)
) {
confs.forEach(c => session.addTrackConf(c))
confs.forEach(c => model.view.showTrack(c.trackId))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there was a bug here where I think it wanted to showTrack(c.trackId) but instead it was just forEach c=>c.trackId

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Oct 3, 2023
@cmdcolin cmdcolin merged commit 9b40810 into main Oct 3, 2023
1 check passed
@cmdcolin cmdcolin deleted the avoid_any branch October 3, 2023 16:17
@cmdcolin cmdcolin added bug Something isn't working and removed needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) labels Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant