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

First timer: Remove jQuery part 1 #540

Merged
merged 10 commits into from
Apr 21, 2020

Conversation

carlo-ev
Copy link
Contributor

@carlo-ev carlo-ev commented Jan 29, 2020

Fixes #538

@sashadev-sky
Thanks for the opportunity to contribute for the first time, please let me know if I have to change something.

Thank you once more!

@welcome
Copy link

welcome bot commented Jan 29, 2020

Thanks for opening this pull request! Dangerbot will test out your code and reply in a bit with some pointers and requests.
There may be some errors, but don't worry! We're here to help! 👍🎉😄

@carlo-ev carlo-ev changed the title refactored two ajax request to simple xhr First timer: Remove jQuery part 1 Jan 29, 2020
Copy link
Member

@sashadev-sky sashadev-sky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlo-ev thank you for the PR! Sorry to get back to you so late - great work :) I left a review to complete before it's ready for merge

src/edit/DistortableCollection.Edit.js Outdated Show resolved Hide resolved
Copy link
Member

@sashadev-sky sashadev-sky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work fixing the code after the first review. Now we also want to make sure cross domain requests work too.

Btw -- should have mentioned this earlier, we just started supporting ES6 if you prefer using the Fetch API. XHR is fine too though so totally your call!

src/edit/DistortableCollection.Edit.js Outdated Show resolved Hide resolved
src/edit/DistortableCollection.Edit.js Outdated Show resolved Hide resolved
Copy link
Member

@sashadev-sky sashadev-sky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok we're getting there thank you for sticking through it!

Some changes are

  1. var request = new Request(open.exportStartUrl, requestOptions); I think you meant to do opts.exportStartUrl
  2. in _defaultFetchStatusUrl and _defaultHandleStatusRes, you don't want to return response.json(), I think instead response.text(). (response.json() will throw an error).

You can scratch my above comment about rebasing it -- i figured out how to do it for you as you can see below in the commits

@sashadev-sky sashadev-sky force-pushed the first-timer-jq-pt1 branch 3 times, most recently from 41825b3 to 46766d1 Compare April 14, 2020 16:45
@sashadev-sky
Copy link
Member

@carlo-ev note before you make any changes you'l want to pul in locally the rebase i did for you here. -- so $ git pull https://github.com/publiclab/Leaflet.DistortableImage.git first-timer-jq-pt1

@carlo-ev
Copy link
Contributor Author

I fix the "opts" mistype and changed both response return from json to text.
Sorry for wasting your time with those mistakes.
I hope this one is good.

@sashadev-sky
Copy link
Member

@carlo-ev no worries, just make sure you are checking your work in the future by running the code locally. Rebasing your dist file and then reviewing again!

@sashadev-sky sashadev-sky force-pushed the first-timer-jq-pt1 branch 2 times, most recently from 2fe4ffb to 3ba0687 Compare April 20, 2020 23:01
@sashadev-sky
Copy link
Member

sashadev-sky commented Apr 21, 2020

@jywarren @VladimirMikulic this looks good to me, any idea why it's getting stuck on the "compositing" step again? I think in the past that has indicated a CORS issue? I have it up on my gh pages here: https://sasha.mapknitter.org/examples/select.html

Copy link
Contributor

@VladimirMikulic VladimirMikulic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code overall would be much cleaner with async/await. That's why I've setup Webpack in the first place:)

@VladimirMikulic
Copy link
Contributor

@sashadev-sky could you clarify, where is it stuck? What action should be triggered?

@sashadev-sky
Copy link
Member

@VladimirMikulic i'm thinking since this was meant as an FTO and it's already implemented without async/await, we can save that for another PR. Are you on board with that? sorry should've gotten you involved earlier!

Also did you try it out on the page i linked? It just continues compositing endlessly. Meaning something is going wrong but it's not being indicated in the console.

@sashadev-sky

This comment has been minimized.

@sashadev-sky
Copy link
Member

@VladimirMikulic sorry that was my bad!! I turned on enforce https in my gh-pages settings. I'll make the change you requested because that was actually my suggestion not the contributors and request your review again for merge

@VladimirMikulic
Copy link
Contributor

That's what I suspected haha :)

Copy link
Contributor

@VladimirMikulic VladimirMikulic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't what you're missing (async/await) :)

@sashadev-sky
Copy link
Member

@VladimirMikulic I'll make a follow up FTO!

@sashadev-sky sashadev-sky merged commit d2e6b3f into publiclab:main Apr 21, 2020
@sashadev-sky
Copy link
Member

@carlo-ev thank you so much for the great work!

@welcome
Copy link

welcome bot commented Apr 21, 2020

Congrats on merging your first pull request! 🙌🎉⚡️
Your code will likely be published to https://mapknitter.org in the next few days.
In the meantime, can you tell us your Twitter handle so we can thank you properly?
Now that you've completed this, you can help someone else take their first step!
See: Public Lab's coding community!

sashadev-sky added a commit to sashadev-sky/Leaflet.DistortableImage that referenced this pull request Apr 21, 2020
* refactored two ajax request to simple xhr

* added verify to request success

* changed requests to fetch api

* Rebase

* check out package.json

* Revert package.json state to main

* change request url mistype and fixed response transform

* Rebase

* Rebase package-lock

* Update response 200 to response.ok

Co-authored-by: sashadev-sky <[email protected]>
@carlo-ev
Copy link
Contributor Author

@sashadev-sky thank you so much for the opportunity to help! Hope there's some more minor issues I can help with.

@sashadev-sky
Copy link
Member

@carlo-ev what are you interested in?

@carlo-ev
Copy link
Contributor Author

@sashadev-sky maybe issues #338 or #311 if that's ok, saw a lot already claimed on the "help wanted".

@sashadev-sky
Copy link
Member

Yes, nobody is currently working on those so that would be awesome!! Thank you :) Feel free to let me know if you need any guidance on them! @carlo-ev

@carlo-ev carlo-ev deleted the first-timer-jq-pt1 branch June 7, 2020 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor code to eventually remove jquery dependency - part 1
3 participants