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

Trouble receiving note on iOS #15

Open
ryanpcmcquen opened this issue Sep 18, 2020 · 18 comments
Open

Trouble receiving note on iOS #15

ryanpcmcquen opened this issue Sep 18, 2020 · 18 comments

Comments

@ryanpcmcquen
Copy link
Contributor

My editor works fine in Firefox on a desktop comp, but on an iPhone, the note doesn't seem to receive data, so the note is aways blank.

https://github.com/ryanpcmcquen/standardnotes_org_mode_editor

I am on iOS 14. Any ideas on how I can fix this?

@JaspalSuri
Copy link
Contributor

JaspalSuri commented Sep 19, 2020

Currently on our internal beta, anything that I type into the note doesn't get saved. Reloading the latest stable web app shows that the changes I've made weren't saved, either. Can you open a duplicate tab of the web app to see if the changes were saved (if you haven't already)?

@ryanpcmcquen
Copy link
Contributor Author

The web app works correctly.

@JaspalSuri
Copy link
Contributor

Does the README on the repo have the latest link to the extension? I've noticed that it changed, but the desktop said that it was unable to download the extension for some reason, despite having successfully installed it.

@ryanpcmcquen
Copy link
Contributor Author

The link changed because that CDN was creating issues ... as far as I know it should install successfully with the new link.

@ryanpcmcquen
Copy link
Contributor Author

@mobitar and @JaspalSuri, this is actually a regression with 1.2.8.

1.2.7 works perfectly with my extension.

@moughxyz
Copy link
Member

Security related changes in 1.2.8: 23987a8#diff-fcef9a4765497500d480c035ab3870c8

@ryanpcmcquen
Copy link
Contributor Author

ryanpcmcquen commented Sep 27, 2020

I think this would break all external editors on at least iOS.

@ryanpcmcquen
Copy link
Contributor Author

Has anyone found a workaround for iOS?

@SebTota
Copy link
Contributor

SebTota commented Aug 3, 2021

I am having the same issue. I initially started building an editor using editor-kit when I experienced this issue. I then switched to component-relay thinking editor-kit was the issue, but the issue persisted. Rolling back to [email protected] does fix the issue as @ryanpcmcquen mentioned.

The issue seems to be coming from this change going from 1.2.7 to 1.2.8.

This actually causes problems on all platforms (in certain environments), but it happens to be more prevalent on iOS. Contrary to this inline comment, the first event is not always the most reliable one.

The first event on iOS seems to be an incomplete message.
Screen Shot 2021-08-03 at 10 10 09 AM

And all further messages actually lack an origin.
Screen Shot 2021-08-03 at 10 11 59 AM

There is actually a note, and fix, regarding what I believe is this issue in the unit test.

Further, this is not only an issue on iOS but on all platforms. I've noticed this exact same issue on Android but it happens much less frequently. My guess is that most of the time the first event that is fired in Android is a valid event and the origin is set properly.

Also, a similar issue occurs on desktop platforms (at least on Mac OS), but it is slightly different and occurs quite rarely in development mode when using Webpack.

Dev:
Screen Shot 2021-08-03 at 10 21 37 AM

Prod:
Prod-Startup-Events

This event is rare and most of the time the component-registered event will fire off first, therefore ignoring the webpackOK event, but it is not a guarantee. This can be pretty frustrating because it's difficult to debug an issue like that and it can cause a lot of confusion for developers.

I propose this if statement is changed to check if the action of the event data is a register-component event because that would theoretically be more reliable than just assuming the first event is the most reliable.

I can make a PR for this if you'd like, I just want to make sure you know how I came to this conclusion and to see if you agree.

@JaspalSuri
Copy link
Contributor

Hi @SebTota, thank you for looking into this! I'll forward this to the dev team to review and they'll let you know whether or not to make a PR for it. (You can always make a PR, of course, but I'll have them review your comment to save you time.)

@johnny243
Copy link
Contributor

Hi @SebTota, thanks for your insight on this. Just to make sure I'm following you correctly, is this issue present on latest [email protected]?

@SebTota
Copy link
Contributor

SebTota commented Aug 5, 2021

Hi @johnny243, yes this issue was present on the latest [email protected]. To be completely clear, it was on the latest version of editor-kit. Once I saw the issue while using editor-kit, I removed the editor-kit logic and started using component-relay where the issue persisted.

I then rolled back to [email protected], like @ryanpcmcquen suggested, which finally allowed the application to work on all platforms. Finally, I rolled up to [email protected] where the issue came back on iOS.

Strangely though, I've built two editors and only one experienced the issue. With both editors, the editors themselves do actually render and are usable. The issue is that they do not load the saved notes content and they also don't save any new updates to the note content as you type.

I was going to test my other editor that did work on iOS, or maybe even just the Bold Editor since that also works, but I haven't had the time. I'll update the issue here if I get a chance to test one of them today.

@moughxyz
Copy link
Member

moughxyz commented Aug 6, 2021

The proposed fix of taking the origin from the component-registered event makes sense, but in your screenshots that event doesn't have an origin, so this wouldn't ultimately solve the issue right? Given that none of our editors have this issue, and that our editors don't do anything special, this is most likely something to do with your editor. Can you share the code for your working editor on iOS, and non-working editor on iOS? Perhaps we can deduce a difference.

@SebTota
Copy link
Contributor

SebTota commented Aug 6, 2021

Can you share the code for your working editor on iOS, and non-working editor on iOS?

Both of these are using editor-kit, but if you'd like me to revert them back to component-relay please let me know.
Working on iOS
Not working on iOS

As a heads up, the editor that works on iOS didn't have its font finished so everything looks super dark and hard to read. But you can still see the changes being made and saved.

The proposed fix of taking the origin from the component-registered event makes sense, but in your screenshots that event doesn't have an origin, so this wouldn't ultimately solve the issue right?

After looking into the events that come from Bold Editor, it does look like the event that is causing trouble for me doesn't occur in the Bold Editor. I can probably figure something out to try to block that event for my editor, but I just thought it was interesting that I wasn't the only one having this issue.

@SebTota
Copy link
Contributor

SebTota commented Aug 8, 2021

I create a PR because I think it may be easier to show that way.

This would solve the issue because it would ignore all the webpackOk events both in the dev environment on desktop and in the iOS application.

I think this would be a better way of doing it than simply ignoring just the webpackOk event because there may be other events (like @ryanpcmcquen scenario) that cause a similar issue as stated here.

If you also want to make sure it hasn't been initalized earlier, for example if two 'component-registered' events were to be fired, you could simply change the if statement to:

if (typeof this.component.origin === 'undefined' && parsedData['action'] === 'component-registered') {
...
}

That way you don't have to worry about this.component.origin always returning false because of an empty origin in the iOS app.

@moughxyz
Copy link
Member

moughxyz commented Aug 9, 2021

Seems like a good fix!

@SebTota
Copy link
Contributor

SebTota commented Aug 10, 2021

@ryanpcmcquen When you get a chance, would you mind testing your editor to see if the issue is now resolved on iOS? I'm not sure if this issue should remain open or not.

@ryanpcmcquen
Copy link
Contributor Author

I don't use Standard Notes anymore ...

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

5 participants