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

GData initialization - Cannot read property 'sort' of undefined #6

Open
tfmorris opened this issue Aug 15, 2020 · 0 comments
Open

GData initialization - Cannot read property 'sort' of undefined #6

tfmorris opened this issue Aug 15, 2020 · 0 comments

Comments

@tfmorris
Copy link
Member

tfmorris commented Aug 15, 2020

It looks like the Google Data importer is attempting to initialize its list of documents at startup even if it isn't visible or being used.

index-bundle.js:37619 Uncaught TypeError: Cannot read property 'sort' of undefined
    at Refine.GDataSourceUI._renderDocuments (index-bundle.js:37619)
    at Object.success (index-bundle.js:37550)
    at fire (index-bundle.js:3234)
    at Object.fireWith [as resolveWith] (index-bundle.js:3364)
    at done (index-bundle.js:9842)
    at XMLHttpRequest.callback (index-bundle.js:10313)

The offending code is

  var docs = o.documents;
  ...
  docs.sort(function(a, b) { return b.updatedDateTime -  a.updatedDateTime; });

Where the contents of o are an error message saying "Not authorized".

It's wasteful to do this initialization at every startup when it's rarely going to be needed. It should be deferred until the importer tab is selected.

It looks like part of the problem is that this test isn't failing:

  if (GdataExtension.isAuthorized()) {
    this._listDocuments();
  }

but it probably shouldn't even be executing that.

Originally posted by @tfmorris in OpenRefine/OpenRefine#3054 (comment)

@wetneb wetneb transferred this issue from OpenRefine/OpenRefine Nov 18, 2024
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

No branches or pull requests

1 participant