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

Fix install plugin workflow and error handling on desktop, update to electron 15 #2322

Merged
merged 4 commits into from
Sep 22, 2021

Conversation

cmdcolin
Copy link
Collaborator

The code in #2247 fails to automatically reload the page to the right session after the user has exited

This adds code in the Loader of jbrowse-desktop that allows specifying a "query parameter" to the electron session that let's it restore a particular config

This query parameters on desktop could also be used for automating desktop via the CLI

Also adds text searching to desktop...random add on but just found it in the process

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Sep 13, 2021
@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 Sep 13, 2021
@cmdcolin cmdcolin marked this pull request as draft September 13, 2021 17:51
@rbuels
Copy link
Contributor

rbuels commented Sep 13, 2021

When adding text searching to desktop, nothing is going to be configured for it right now, so I’d expect things to act the same as before from the users perspective, right?

@cmdcolin
Copy link
Collaborator Author

When adding text searching to desktop, nothing is going to be configured for it right now, so I’d expect things to act the same as before from the users perspective, right?

The preloaded hg19 and hg38 sections include text searching preloads in this PR

@cmdcolin cmdcolin marked this pull request as ready for review September 21, 2021 17:44
@cmdcolin cmdcolin marked this pull request as draft September 21, 2021 20:01
@cmdcolin
Copy link
Collaborator Author

Marked as draft again because this PR sometimes is not reliably working, but unclear why

There is code like this that calls loadSession


  useEffect(() => {
    ;(async () => {
      if (config) {
        try {
          setLoading(true)
          console.log('before')
          const data = await ipcRenderer.invoke('loadSession', config)
          console.log('after')
          const pm = await createPluginManager(JSON.parse(data))
          setPluginManager(pm)
          setConfig('')
          setError(undefined)
        } catch (e) {
          console.log('err')
          console.error(e)
          setError(e)
        } finally {
          console.log('finally')
          setLoading(false)
        }
      }
    })()
  }, [config, setConfig])

Resulting console.log just says "before", no after, no finally, and no catch is executed

Looking at the ipc call I can add logging code to make it say

ipcMain.handle('loadSession', async (_event: unknown, sessionName: string) => {
  console.log('t1')
  const r = await readFile(getPath(sessionName), 'utf8')
  console.log('t2')
  return r
})

This correctly logs

t1
t2

To the console, so it should be returning the results...

So it's unclear why the ipcRenderer.invoke('loadSession',...) is not returning...

@cmdcolin cmdcolin force-pushed the text_searching_desktop branch from d178fed to 77a94d2 Compare September 22, 2021 05:26
@codecov
Copy link

codecov bot commented Sep 22, 2021

Codecov Report

Merging #2322 (897ce63) into main (5769c7e) will decrease coverage by 0.08%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2322      +/-   ##
==========================================
- Coverage   61.92%   61.83%   -0.09%     
==========================================
  Files         511      511              
  Lines       23394    23427      +33     
  Branches     5428     5436       +8     
==========================================
  Hits        14487    14487              
- Misses       8639     8672      +33     
  Partials      268      268              
Impacted Files Coverage Δ
products/jbrowse-desktop/src/Loader.tsx 0.00% <0.00%> (ø)
...e-desktop/src/StartScreen/data/preloadedConfigs.js 0.00% <ø> (ø)
products/jbrowse-desktop/src/StartScreen/index.tsx 0.00% <ø> (ø)
products/jbrowse-desktop/src/corePlugins.ts 100.00% <ø> (ø)
products/jbrowse-desktop/src/index.js 0.00% <ø> (ø)
products/jbrowse-desktop/src/jbrowseModel.js 2.73% <ø> (ø)
products/jbrowse-desktop/src/rootModel.ts 0.86% <0.00%> (-0.02%) ⬇️

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 5769c7e...897ce63. Read the comment docs.

@cmdcolin cmdcolin force-pushed the text_searching_desktop branch from e79313a to 56d67ed Compare September 22, 2021 06:26
@cmdcolin
Copy link
Collaborator Author

I am not precisely sure what caused the behavior described in #2322 (comment)

I did not really perform a root cause analysis but I stopped seeing it after a couple refactorings. if interested could dig deeper

Code also updates to electron 15 (just tested out while attempting refactorings, bug fixes n improvements always good... is not the reason for fix above though) and ports over a error handler (e.g. tells which snapshot failed) from jbrowse-web to jbrowse-desktop.

@cmdcolin cmdcolin marked this pull request as ready for review September 22, 2021 15:08
@cmdcolin cmdcolin merged commit e07b309 into main Sep 22, 2021
@cmdcolin cmdcolin changed the title Fix install plugin workflow on desktop Fix install plugin workflow and error handling on desktop, update to electron 15 Sep 22, 2021
@cmdcolin cmdcolin deleted the text_searching_desktop branch September 22, 2021 15:21
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.

2 participants