Commit b104dc11 authored by Himanshu Kapoor's avatar Himanshu Kapoor Committed by Paul Slaughter

Burst unused seal on new file and rename

Call action burstUnusedSeal on creation of a new file and renaming an
existing file. This prevents a "No changes" empty state from being
shown despite there clearly being changes.
parent bf7edb28
......@@ -110,6 +110,7 @@ export const createTempEntry = (
commit(types.ADD_FILE_TO_CHANGED, file.path);
dispatch('setFileActive', file.path);
dispatch('triggerFilesChange');
dispatch('burstUnusedSeal');
}
if (parentPath && !state.entries[parentPath].opened) {
......@@ -222,7 +223,9 @@ export const deleteEntry = ({ commit, dispatch, state }, path) => {
dispatch('deleteEntry', prevPath);
return;
}
if (state.unusedSeal) dispatch('burstUnusedSeal');
dispatch('burstUnusedSeal');
if (entry.opened) dispatch('closeFile', entry);
if (isTree) {
......@@ -267,6 +270,7 @@ export const renameEntry = ({ dispatch, commit, state }, { path, name, parentPat
commit(types.REMOVE_FILE_FROM_STAGED_AND_CHANGED, newEntry);
} else if (!isInChanges) {
commit(types.ADD_FILE_TO_CHANGED, newPath);
dispatch('burstUnusedSeal');
}
if (!newEntry.tempFile) {
......
---
title: Fix "No changes" empty state showing up in changes tab, despite there being
changes
merge_request: 21713
author:
type: fixed
......@@ -319,7 +319,7 @@ describe('Multi-file store actions', () => {
{ type: types.TOGGLE_FILE_OPEN, payload: 'test' },
{ type: types.ADD_FILE_TO_CHANGED, payload: 'test' },
],
[
jasmine.objectContaining([
{
type: 'setFileActive',
payload: 'test',
......@@ -327,7 +327,7 @@ describe('Multi-file store actions', () => {
{
type: 'triggerFilesChange',
},
],
]),
done,
);
});
......@@ -350,6 +350,21 @@ describe('Multi-file store actions', () => {
})
.catch(done.fail);
});
it('bursts unused seal', done => {
store
.dispatch('createTempEntry', {
name: 'test',
branchId: 'mybranch',
type: 'blob',
})
.then(() => {
expect(store.state.unusedSeal).toBe(false);
done();
})
.catch(done.fail);
});
});
});
......@@ -648,6 +663,19 @@ describe('Multi-file store actions', () => {
],
);
});
it('bursts unused seal', done => {
store.state.entries.test = file('test');
store
.dispatch('deleteEntry', 'test')
.then(() => {
expect(store.state.unusedSeal).toBe(false);
done();
})
.catch(done.fail);
});
});
describe('renameEntry', () => {
......@@ -747,7 +775,7 @@ describe('Multi-file store actions', () => {
payload: 'renamed',
},
],
[{ type: 'triggerFilesChange' }],
[{ type: 'burstUnusedSeal' }, { type: 'triggerFilesChange' }],
done,
);
});
......@@ -807,6 +835,20 @@ describe('Multi-file store actions', () => {
.then(done)
.catch(done.fail);
});
it('bursts unused seal', done => {
store
.dispatch('renameEntry', {
path: 'orig',
name: 'renamed',
})
.then(() => {
expect(store.state.unusedSeal).toBe(false);
done();
})
.catch(done.fail);
});
});
describe('folder', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment