mwouts / itables

Pandas DataFrames as Interactive DataTables
https://mwouts.github.io/itables/
MIT License
767 stars 56 forks source link

VSCode Loading #216

Closed JosuaCarl closed 7 months ago

JosuaCarl commented 8 months ago

I keep getting the "Loading" message when displaying tables with itables

I already followed the Quick Help guide.

JosuaCarl commented 8 months ago

It turns out, you I needed to reload the Jupyter Extension by:

  1. disabling it
  2. reloading it
  3. enabling it again

Maybe add this to the frequent error list, or just leave this here for people to find.

Works like a charm not, thanks for the useful package :)

Norlandz commented 8 months ago

general problem

I face the same issue quite often.

Often times I need to close the file & reopen it. Some table may load, some may still not.

Or, when I scroll away or exec some other cell, some table may become normal again... -- just bit buggy.

(- Or, sometimes some table with long rows, will instead have a huge height.)

current workaround

Later I just found a better workaround for "refresh", under more actions of the cell image

But still it should be fixed...

potential problem

internet?

I once suspected may be internet issue? But doesnt seems like it. And I tried init_notebook_mode(all_interactive=True, connected=False), from related issue https://github.com/mwouts/itables/issues/75 or help page https://mwouts.github.io/itables/troubleshooting.html, no luck.

some errors; promise?

I tried @command:workbench.action.webview.openDeveloperTools in vscode.

Found some errors, not sure came from which extension or what

Uncaught Error: Model is disposed!

Uncaught (in promise) TypeError: $(...).DataTable is not a function
    at <anonymous>:15:60

Uncaught ReferenceError: IPython is not defined

VM446:19 
VS Code Renderer failed to render output ReferenceError: IPython is not defined

preload.js:2156 
Uncaught TypeError: Cannot read properties of undefined (reading 'then')

I suspect it can be: Ipython kernel is not loaded & some async promise in js fail? idk...


@JosuaCarl Maybe reopen the issue?

mwouts commented 8 months ago

Hey @Norlandz , thank you for following up on this. Actually the connected mode has a simpler implementation, would you mind trying connected=True in init_notebook_mode? Please let us know if that works any better. Thanks!

Norlandz commented 8 months ago

@mwouts

trying connected=True in init_notebook_mode? https://github.com/mwouts/itables/issues/216#issuecomment-1913322969

Im not sure, but I dont think connected=True is the solve.

-- I use connected=False always. Because I want my notebook to work in offline

(--ie: after I run the notebook, get the output, close it, and open the ipynb in another computer with no internet, I should still able to see the output & interact with it -- should I use connected=True for this?).

-- The problem is: sometimes, some of the table just keeps in Loading state. I have to close and reopen the file in vscode, so that they get refreshed & may load properly.

-- Do you want me to try anyways?

mwouts commented 8 months ago

Hey @Norlandz , yes I do understand that you have a preference for connected=False on the long term (me too, and that's why I made it the default).

Still, if connected=True happened to works more reliably than connected=False in VS Code in the current version of itables, that could mean that https://github.com/mwouts/itables/blob/main/itables/html/initialize_offline_datatable.html does not work as expected in VS Code, so we could probably try and see how to make that part of the code work more consistently.

mwouts commented 8 months ago

Hey @JosuaCarl , @Norlandz , would you mind giving a try at this development version, and let me know whether it solves the loading issue in VS Code?

pip install git+https://github.com/mwouts/itables.git@version_1.7.0
Norlandz commented 8 months ago

@mwouts

Hey @JosuaCarl , @Norlandz , would you mind giving a try at this development version, and let me know whether it solves the loading issue in VS Code?

pip install git+https://github.com/mwouts/itables.git@version_1.7.0

Sure.

--

Some notes:

For 1.6.3 (prev experience):

For 1.7.0:

mwouts commented 7 months ago

seems like the custom css itables.options.css = doesnt work in dev version?

Oh I see, this should be restored now (on the same branch, please re-do the pip install git+https://github.com/mwouts/itables.git@version_1.7.0)