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

UI: Replace jQuery with fetch within Ember Data #8035

Merged
merged 10 commits into from
May 26, 2020

Conversation

DingoEatingFuzz
Copy link
Contributor

@DingoEatingFuzz DingoEatingFuzz commented May 21, 2020

This work is part of #7834

Switching out jQuery.ajax with fetch is theoretically easy with Ember Data. They made a best effort to first hide all of jQuery as an implementation detail and second use fetch in a way that emulates how jQuery works.

However, we do a lot of idiosyncratic things with Ember Data including overriding the occasional private API in order to support blocking queries. It's not surprising that there was some tweaking that needed to happen.

I tried to be methodical with each commit, so reading through this commit-by-commit is advised.

Size Impact
I wouldn't expect this to have too much of a size impact. jQuery isn't being removed and Ember Data's fetch flag is evaluated at runtime, so there is no dead code elimination that takes place as a result of this switch.

Performance Impact
Since Ember Data plays a role in nearly all acceptance tests, it's possible there will be a performance impact.

@github-actions
Copy link

github-actions bot commented May 21, 2020

Ember Asset Size action

As of 06720bd

Files that got Smaller 🎉:

File raw gzip
nomad-ui.js -984 B -180 B

Files that stayed the same size 🤷‍:

File raw gzip
auto-import-fastboot.js 0 B 0 B
vendor.js 0 B 0 B
nomad-ui.css 0 B 0 B
vendor.css 0 B 0 B

Copy link
Contributor

@backspace backspace left a comment

Choose a reason for hiding this comment

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

Looks good, the per-commit way to read was indeed helpful, thanks. I’m glad there are some tests that cover the AbortController aspects. I do wonder whether this is a situation where a brief exercise in the various supported browsers is worth doing; IE in particular worries me.

ui/app/components/job-page/parts/title.js Show resolved Hide resolved
@@ -133,7 +133,7 @@ module('Unit | Adapter | Job', function(hooks) {
await settled();

assert.notOk(
pretender.handledRequests.mapBy('requestHeaders').some(headers => headers['X-Nomad-Token']),
pretender.handledRequests.mapBy('requestHeaders').some(headers => headers['x-nomad-token']),
Copy link
Contributor

Choose a reason for hiding this comment

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

It’s unfortunate that this matters 😞 but oh well

@DingoEatingFuzz
Copy link
Contributor Author

I also had your concerns around AbortController and browser support, but it turns out ember-fetch polyfills this (thus the import from 'fetch' and the removal of the MockAbortController).

https://github.com/ember-cli/ember-fetch/blob/77c8b2cbfcb2ddcb0d1fac4f5fd3224b7b893680/index.js#L171-L194

AbortController also has full evergreen support at this point: https://caniuse.com/#feat=abortcontroller

@github-actions
Copy link

github-actions bot commented May 21, 2020

Ember Test Audit comparison

master 06720bd change
passes 1334 1333 -1
failures 0 0 0
flaky 0 0 0
duration 4m 48s 256ms 5m 07s 691ms +19s 435ms

@DingoEatingFuzz DingoEatingFuzz removed this from the 0.12.0 milestone May 21, 2020
@DingoEatingFuzz DingoEatingFuzz merged commit f1acc77 into master May 26, 2020
@DingoEatingFuzz DingoEatingFuzz deleted the f-ui/ember-fetch branch May 26, 2020 19:32
backspace added a commit that referenced this pull request Jan 28, 2021
This fixes all the test failures seen here apart from the
job adapter ones:
https://app.circleci.com/pipelines/github/hashicorp/nomad/14501/workflows/01177cd9-a2ae-4fff-94ef-6b109b778123/jobs/134238

This was last toggled in #8035 and it’s frustrating to have
to change it back but I couldn’t find another way 😞
backspace added a commit that referenced this pull request Jan 28, 2021
This fixes all the test failures seen here apart from the
job adapter ones:
https://app.circleci.com/pipelines/github/hashicorp/nomad/14501/workflows/01177cd9-a2ae-4fff-94ef-6b109b778123/jobs/134238

This was last toggled in #8035 and it’s frustrating to have
to change it back but I couldn’t find another way 😞
@github-actions
Copy link

github-actions bot commented Jan 5, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants