Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/actions/tests/pending-breakpoints.spec.js b/src/actions/tests/pending-breakpoints.spec.js
- index c381039..3fa989f 100644
- --- a/src/actions/tests/pending-breakpoints.spec.js
- +++ b/src/actions/tests/pending-breakpoints.spec.js
- @@ -94,6 +94,19 @@ describe("when adding breakpoints", () => {
- expect(pendingBps.get(breakpointLocationId2)).toMatchSnapshot();
- });
- + it("hidden breakponts do not create pending bps", async () => {
- + const { dispatch, getState } = createStore(simpleMockThreadClient);
- +
- + await dispatch(actions.newSource(makeSource("foo")));
- + await dispatch(
- + actions.addBreakpoint(breakpoint1.location, { hidden: true })
- + );
- + const pendingBps = selectors.getPendingBreakpoints(getState());
- +
- + // should be null
- + expect(pendingBps.get(breakpointLocationId1)).toBe(null);
- + });
- +
- it("remove a corresponding pending breakpoint when deleting", async () => {
- const { dispatch, getState } = createStore(simpleMockThreadClient);
- await dispatch(actions.newSource(makeSource("foo")));
- diff --git a/src/reducers/pending-breakpoints.js b/src/reducers/pending-breakpoints.js
- index 0cd7419..be85711 100644
- --- a/src/reducers/pending-breakpoints.js
- +++ b/src/reducers/pending-breakpoints.js
- @@ -31,6 +31,7 @@ export type PendingBreakpointsState = {
- export function initialState(): Record<PendingBreakpointsState> {
- return makeRecord(
- ({
- + // this is where we load the pending breakpoints when the debugger opens
- pendingBreakpoints: restorePendingBreakpoints()
- }: PendingBreakpointsState)
- )();
- @@ -42,6 +43,11 @@ function update(
- ) {
- switch (action.type) {
- case "ADD_BREAKPOINT": {
- + if (action.breakpoint.hidden) {
- + return;
- + }
- +
- + // we could add an IF here so that we avoid adding hidden bps
- return addBreakpoint(state, action);
- }
- @@ -61,7 +67,11 @@ function update(
- return updateBreakpoint(state, action);
- }
- - case "REMOVE_BREAKPOINT": {
- + case "REMOVE_BREAKPOINT":
- + // we could add an IF here so that we no op hidden bps {
- + if (action.breakpoint.hidden) {
- + return;
- + }
- return removeBreakpoint(state, action);
- }
- }
- @@ -99,6 +109,8 @@ function syncBreakpoint(state, action) {
- function updateBreakpoint(state, action) {
- const { breakpoint } = action;
- const locationId = makePendingLocationId(breakpoint.location);
- +
- + // this is how we set the data to save for a bp
- const pendingBreakpoint = createPendingBreakpoint(breakpoint);
- return state.setIn(["pendingBreakpoints", locationId], pendingBreakpoint);
- @@ -136,6 +148,7 @@ export function getPendingBreakpointsForSource(
- );
- }
- +// this is where we load the pending breakpoints when the debugger opens
- function restorePendingBreakpoints() {
- return I.Map(prefs.pendingBreakpoints);
- }
- diff --git a/src/utils/bootstrap.js b/src/utils/bootstrap.js
- index 2e944d6..e16bd02 100644
- --- a/src/utils/bootstrap.js
- +++ b/src/utils/bootstrap.js
- @@ -73,6 +73,7 @@ export function teardownWorkers() {
- function updatePrefs(state) {
- const pendingBreakpoints = selectors.getPendingBreakpoints(state);
- + // this is how we save pending bps
- if (prefs.pendingBreakpoints !== pendingBreakpoints) {
- prefs.pendingBreakpoints = pendingBreakpoints;
- }
- diff --git a/src/utils/breakpoint/index.js b/src/utils/breakpoint/index.js
- index b25c3c7..69d2306 100644
- --- a/src/utils/breakpoint/index.js
- +++ b/src/utils/breakpoint/index.js
- @@ -128,6 +128,7 @@ function createPendingLocation(location: PendingLocation) {
- return { sourceUrl, line, column };
- }
- +// pending bps are basically bps, without a source id
- export function createPendingBreakpoint(bp: Breakpoint) {
- const pendingLocation = createPendingLocation(bp.location);
- const pendingGeneratedLocation = createPendingLocation(bp.generatedLocation);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement