未验证 提交 2aaa0222 编写于 作者: P Phil Hughes

fixed delayed update viewer

fixed `key` not being set to correct value
上级 b61aa6f8
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
}) })
.then(() => { .then(() => {
const viewerPromise = this.delayViewerUpdated const viewerPromise = this.delayViewerUpdated
? this.updateViewer('editor') ? this.updateViewer(this.file.pending ? 'diff' : 'editor')
: Promise.resolve(); : Promise.resolve();
return viewerPromise; return viewerPromise;
......
...@@ -7,9 +7,9 @@ export const commitButtonDisabled = (state, getters, rootState) => ...@@ -7,9 +7,9 @@ export const commitButtonDisabled = (state, getters, rootState) =>
getters.discardDraftButtonDisabled || !rootState.stagedFiles.length; getters.discardDraftButtonDisabled || !rootState.stagedFiles.length;
export const newBranchName = (state, _, rootState) => export const newBranchName = (state, _, rootState) =>
`${gon.current_username}-${ `${gon.current_username}-${rootState.currentBranchId}-patch-${`${new Date().getTime()}`.substr(
rootState.currentBranchId -5,
}-patch-${`${new Date().getTime()}`.substr(-5)}`; )}`;
export const branchName = (state, getters, rootState) => { export const branchName = (state, getters, rootState) => {
if ( if (
......
...@@ -131,6 +131,7 @@ export default { ...@@ -131,6 +131,7 @@ export default {
if (!changedFile && stagedFile) { if (!changedFile && stagedFile) {
Object.assign(state.entries[path], { Object.assign(state.entries[path], {
...stagedFile, ...stagedFile,
key: state.entries[path].key,
changed: true, changed: true,
}); });
......
...@@ -88,8 +88,7 @@ export const decorateData = entity => { ...@@ -88,8 +88,7 @@ export const decorateData = entity => {
export const findEntry = (tree, type, name, prop = 'name') => export const findEntry = (tree, type, name, prop = 'name') =>
tree.find(f => f.type === type && f[prop] === name); tree.find(f => f.type === type && f[prop] === name);
export const findIndexOfFile = (state, file) => export const findIndexOfFile = (state, file) => state.findIndex(f => f.path === file.path);
state.findIndex(f => f.path === file.path);
export const setPageTitle = title => { export const setPageTitle = title => {
document.title = title; document.title = title;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册