standardnotes / component-relay

A bridge that handles communication between Standard Notes and an external extension.
https://docs.standardnotes.com/extensions/components
GNU Affero General Public License v3.0
12 stars 5 forks source link

Fix certain iOS editors failing to load and save note content #42

Closed SebTota closed 3 years ago

SebTota commented 3 years ago

Reference Issue: #15

SebTota commented 3 years ago

I'm not sure if the comment should be changed now as well since we will no longer be simply taking the first event that comes. Would you agree?

moughxyz commented 3 years ago

Hmm tests are failing for me locally now. @SebTota can you run the tests locally to see if the same?

SebTota commented 3 years ago

@mobitar Sorry, I didn't have a chance to test locally yet with all the new changes.

I just tested now, and it seems like the typeof this.component.origin === 'undefined' is actually causing the problem. I may have to wait until later to figure out why, but I will let you know what I find. Feel free to revert for now if you need to.

I did ignore the failed tests and built anyway and the changes do seem to fix the problem on iOS. I also tested with Bold Editor just to make sure nothing broke and it works well.

SebTota commented 3 years ago

From a quick glance, this might be the problem.

SebTota commented 3 years ago

@mobitar Please check my most recent commit on my repo. I'm unsure of how to reopen this PR to add the commit.

Update: This fixes the unit tests. Essentially, you always had duplicate events firing in your unit tests but since !"" always returned true it sort of bypassed the problem by just setting the origin to the second event that was fired. The new commit should fix it though.

moughxyz commented 3 years ago

You'd just open another PR with these changes 👍