Extension development issue: "restorer.restore is not a function"

I’m working on a jupyterlab extension to add links in the Help menu to arbitrary URLs (for my purposes, internal API docs, but I hope to write this generically enough for anyone to use and configure).

I’m using the astronomy photo extension tutorial as well as jupyterlab’s help-extension as reference points.

I’ve been stuck for a while now on how to restore tabs on browser restart.

Chrome dev tools console is reporting the error on load as “restorer.restore is not a function”. I think I’m doing it correctly in my index.ts-- importing ILayoutRestorer, adding it to the requires list of the JupyterFrontEndPlugin definition, assigning ILayoutRestorer to the name “restorer” in the extension function arguments.

Any ideas what I’m doing wrong?

cheers,
Ben

1 Like

Hi @bklaa, it’s tough to say for sure without a code sample – can you post any snippets or a link to your code?

One thing you might want to check: is the order of tokens in requires the same as the ordering in your extension’s activate function? If they are not in the same order, you can get errors like this.

1 Like

That was it @ian-r-rose, thanks! As a typically-in-Python programmer, I think I was looking at those named arguments like **kwargs and didn’t think order would matter. Makes sense considering the objects are sent as a list.

The other user error that got me stuck was forgetting to run jlpm run build after changes, which was a pretty bad gotcha. I think I’d tried fixing the function argument order quite a while ago but dismissed it as a dead-end, when in fact I’d just forgotten to rebuild.

cheers and thanks for the help,
Ben

2 Likes