Closed Bug 1418969 Opened 7 years ago Closed 6 years ago

Remove helper API from requests reducer

Categories

(DevTools :: Netmonitor, enhancement, P2)

enhancement

Tracking

(firefox60 fixed)

RESOLVED FIXED
Firefox 60
Tracking Status
firefox60 --- fixed

People

(Reporter: Honza, Assigned: abhinav.koppula, Mentored)

Details

(Whiteboard: good-first-bug)

Attachments

(1 file, 1 obsolete file)

This is a follow-up for bug 1408182

We should remove helper API (relic from times when we used ImmutableJS) from
devtools/client/netmonitor/src/reducers:

* isEmpty 
* valueSeq

Look at the bottom of the file. The following function:

function mapNew(map) {
  let newMap = new Map(map);
  newMap.isEmpty = () => newMap.size == 0;
  newMap.valueSeq = () => [...newMap.values()];
  return newMap;
}

... should be as follows:

function mapNew(map) {
  return new Map(map);
}

... and consequently, it can be removed entirely and `new Map(map)` used directly.

The rest of the code base should be adopted not to use the API anymore.

Honza
Mentor: odvarko
Priority: -- → P2
Whiteboard: good-first-bug
> We should remove helper API (relic from times when we used ImmutableJS) from
> devtools/client/netmonitor/src/reducers:

Correction, the name of the file is:
devtools/client/netmonitor/src/reducers/requests.js

Honza
We should also remove helpers from `getSortedRequests` and `getDisplayedRequests` selectors.

devtools/client/netmonitor/src/selectors/requests.js

There are:
`get` and `isEmpty` API defined inside these two selectors -> remove it.

Honza
Hey I'd like to fix this if that's possible. Thanks
I wonder if I could work on this bug. Thank you
(In reply to Joshua Longhi from comment #3)
> Hey I'd like to fix this if that's possible. Thanks
Sure, assigned to you.


(In reply to Jaewoongyu from comment #4)
> I wonder if I could work on this bug. Thank you
Sorry, Joshua was first.

Honza
Assignee: nobody → joshualonghi
What about 'requests: mapNew()' on line 31? Can this be changed to new Map()?
Hey Joshua,

remember to add bug number & reviewer in your commit message `Bug 1418969 - Remove helper API from requests reducer r=honza`, so that honza will be informed about your review request. Otherwise, he might forgot your patch.
Flags: needinfo?(joshualonghi)
Flags: needinfo?(joshualonghi)
Honza, Can I take this forward?
Flags: needinfo?(odvarko)
Let me know only if no one is actively working on this issue and is free to be taken.
Comment on attachment 8935966 [details] [diff] [review]
Remove helper API from requests reducer

Review of attachment 8935966 [details] [diff] [review]:
-----------------------------------------------------------------

This is good start, but other places in the code needs to be fixed as well.

Failures in this try-push should indicate what places in the code base should be fixed:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5d67f1208ebe040adfe21a18747bc2de45995007

Honza
(In reply to Abhinav Koppula from comment #10)
> Let me know only if no one is actively working on this issue and is free to
> be taken.

Yes, it's free. Joshua doesn't seem to work on this one anymore.
Assigned to you Abhinav!

Honza
Assignee: joshualonghi → abhinav.koppula
Flags: needinfo?(odvarko)
Comment on attachment 8944188 [details]
Bug 1418969 - Remove helper API from requests reducer;

https://reviewboard.mozilla.org/r/214474/#review220156

Thanks Abhinav for working on this!

One inline comment + let's wait for try results.

Honza

::: devtools/client/netmonitor/src/reducers/requests.js:177
(Diff revision 1)
>        if (!action.open) {
>          nextState.selectedId = null;
>          return nextState;
>        }
>  
> -      if (!state.selectedId && !state.requests.isEmpty()) {
> +      if (!state.selectedId && !(state.requests.size == 0)) {

Please change to: state.requests.size > 0
Attachment #8944188 - Flags: review?(odvarko)
Comment on attachment 8944188 [details]
Bug 1418969 - Remove helper API from requests reducer;

https://reviewboard.mozilla.org/r/214474/#review220156

Done.
Attachment #8935966 - Attachment is obsolete: true
Comment on attachment 8944188 [details]
Bug 1418969 - Remove helper API from requests reducer;

https://reviewboard.mozilla.org/r/214474/#review220498

Looks good!

R+ (try green)

Honza
Attachment #8944188 - Flags: review?(odvarko) → review+
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/df6485ef321a
Remove helper API from requests reducer; r=Honza
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/df6485ef321a
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 60
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: