-
Notifications
You must be signed in to change notification settings - Fork 758
Share querystring logic with tabs & breakpoints sidebar #7206
Share querystring logic with tabs & breakpoints sidebar #7206
Conversation
src/components/Editor/Tab.js
Outdated
@@ -198,6 +204,7 @@ class Tab extends PureComponent<Props> { | |||
/> | |||
<div className="filename"> | |||
{getTruncatedFileName(source)} | |||
{query} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source tree item stuff has this in a span, but I wasn't sure if this needed to be. I think it looks better sans span in the tab, but I am open to feedback 😄
@@ -440,6 +440,14 @@ export function getSourcesUrlsInSources(state: OuterState, url: string) { | |||
return [...new Set(Object.keys(urls).filter(Boolean))]; | |||
} | |||
|
|||
export function getHasSiblingOfSameName(state: OuterState, source: ?Source) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function is in the SourcesTree
file, so I think we should move it somewhere in utils/source.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, missed the change about it 🤕
This works great! 👍 |
The sub-component allows us to leverage the OuterState to see if there are any siblings with matching names. Applied the same querystring logic as Tab & SourceTreeItem
I wanted to add a breakpoint to one of the files and assert that the query shows in the panel. I'm having issues getting the breakpoint to show up in the panel when adding it with the helpers.
|
Hello @WenInCode! It took me a while to track down but try this: // Select the source so that the breakpoint displays in sidebar
const source = findSource(dbg, "simple1.js?x=1");
await selectSource(dbg, source);
await addBreakpoint(dbg, "simple1.js?x=1", 6);
await waitForever(); |
@darkwing that makes a lot of sense 😂 thanks! I also didn't realize you could just use I am going to start looking more into getting the project search to work with params again. That work can either land in this, or separate, whatever works best 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work so far @WenInCode ! Only one quick thing to look at:
We need to ensure truncation occurs within tabs and sidebar. The tabs already use a truncate function, so you simply need to concat the filename add the querystring before using the function there.
For the sidebar, we need to (1) remove the space between the querystring and the filename, and then ensure we use text-overflow: ellipsis
@darkwing I truncated the long file names 👍 I also noticed that the title attributes for the heading and the tab were not consistent. The heading showed the entire file url, whereas the tab showed a truncated portion which ended up just being part of the query. I updated them to be consistent. Let me know if you think it should be different 😄 |
Fixes #7159
Summary of Changes
Test Plan
script.js
source and observe the query string appended to the name in the tabscript.js
and observe the query string appended to the name in the breakpoints sidebarMochitests
dbg-sources-querystring
dbg-sources-querystring
Screenshots
Questions/Thoughts
I considered moving
https://github.com/wenincode/debugger.html/blob/7159-source-querystring-logic-tabs-sidebar/src/reducers/sources.js#L434-L449
into a separateutils
because they aren't actualreducers
and aren't actually being used by thereducer
in this file. I think they are in here because the code is a bit tied to theOuterState
type. I was going to move it and change the types to just be an array of sources to try and decouple it from this file, but the more I work with it the more I see why it is the way it is now. Just seemed a bit odd to have these functions in here.For the adding logic to sidebar stuff I am thinking of moving [this code] into a sub-component. The reasoning being that I think I could leverage a similar
mapStateToProps
withOuterState
approach as the other two areas. I am not entirely sure how that all works yet, still pretty new to redux land. I just don't currently see how I can get the right state to pass into those functions in the reducer without moving this code. Just wanted to capture my thoughts before I shut down for the night 😄