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

Notebook Objects cannot be created with CouchDB enabled #4422

Closed
3 of 5 tasks
scottbell opened this issue Nov 1, 2021 · 4 comments
Closed
3 of 5 tasks

Notebook Objects cannot be created with CouchDB enabled #4422

scottbell opened this issue Nov 1, 2021 · 4 comments

Comments

@scottbell
Copy link
Contributor

Summary

Creating a Notebook Object causes OpenMCT with CouchDB causes a "Save Failed" notification message in the UI, and an uncaught exception in the console:

Editor.js?3ce0:82 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'cancel')
    at eval (Editor.js?3ce0:82)
    at new Promise (<anonymous>)
    at Editor.cancel (Editor.js?3ce0:80)
    at onCancel (CreateAction.js?95e8:71)
    at processQueue (angular.js?21b1:18075)
    at eval (angular.js?21b1:18123)
    at Scope.$digest (angular.js?21b1:19242)
    at eval (angular.js?21b1:19562)
    at TaskTracker.completeTask (angular.js?21b1:21403)
    at eval (angular.js?21b1:6879)

This prevents Notebook Objects from being used at all when CouchDB is enabled.

Expected vs Current Behavior

The Notebook Object should be created, saved into CouchDB, and updated with changes.

Impact Check List

  • Data loss or misrepresented data?
  • Regression? Did this used to work or has it always been broken?
  • Is there a workaround available?
  • Does this impact a critical component?
  • Is this just a visual bug?

Steps to Reproduce

Enable CouchDB for OpenMCT:
https://github.com/nasa/openmct/blob/master/src/plugins/persistence/couch/README.md
Run OpenMCT and drop a Notebook Object.

Environment

  • Open MCT Version: 1.7.8
  • Deployment Type: npm dev
  • OS: OSX
  • Browser: Chrome

Additional Information

For a running investigation of this issue, see:
#3881 (comment)

Suffice to say, adding a null check here:
https://github.com/nasa/openmct/blob/master/src/plugins/persistence/couch/CouchObjectProvider.js#L373

return () => {
            if (this.observers[keyString]) {
                this.observers[keyString] = this.observers[keyString].filter(observer => observer !== callback);
                if (this.observers[keyString].length === 0) {
                    delete this.observers[keyString];
                    if (Object.keys(this.observers).length === 0 && this.isObservingObjectChanges()) {
                        this.stopObservingObjectChanges();
                    }
                }
            }
        };

seems to fix the issue.

@scottbell
Copy link
Contributor Author

Created a PR for this issue here:
#4425

@nikhilmandlik
Copy link
Contributor

Verified Fixed.

@shefalijoshi
Copy link
Contributor

Verified fixed.

@charlesh88
Copy link
Contributor

Verified fixed Testathon 11-15-21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants