debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[sources] tweak selectSpecificLocation

Open jasonLaster opened this issue 8 years ago • 6 comments

I noticed we call two actions unnecessarily.

  1. closeActiveSearch
  2. addTab

NOTE: i made up hasTab, i have no idea whether that exists :)

diff --git a/src/actions/sources/select.js b/src/actions/sources/select.js
index 3c673fc..0ac5c17 100644
--- a/src/actions/sources/select.js
+++ b/src/actions/sources/select.js
@@ -162,13 +162,16 @@ export function selectSpecificLocation(location: Location) {
     }

     const activeSearch = getActiveSearch(getState());
-    if (activeSearch !== "file") {
+    if (activeSearch && activeSearch !== "file") {
       dispatch(closeActiveSearch());
     }

     const source = sourceRecord.toJS();

-    dispatch(addTab(source, 0));
+    if (!hasTab(getState(), source)) {
+      dispatch(addTab(source, 0));
+    }
+
     dispatch(setSelectedLocation(source, location));

     await dispatch(loadSourceText(sourceRecord));
     ```

jasonLaster avatar May 18 '18 15:05 jasonLaster

/claim

reesscot avatar May 24 '18 00:05 reesscot

Thanks for claiming the issue! :wave:

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar May 24 '18 00:05 claim

@reescott still interested?

jasonLaster avatar Aug 03 '18 14:08 jasonLaster

@jasonLaster, Can I take this one?

kenjiO avatar Aug 22 '18 19:08 kenjiO

sure @kenjiO

jasonLaster avatar Aug 22 '18 20:08 jasonLaster

@jasonLaster I was just browsing through the issues and I think this can be closed now since the pr was merged

WenInCode avatar Oct 04 '18 03:10 WenInCode