Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
8f28ed26
Commit
8f28ed26
authored
6 years ago
by
Ben Wheeler
Browse files
Options
Downloads
Patches
Plain Diff
partial solution to reloading-on-switch-to-editor problem
parent
e70d0472
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/reducers/project-id.js
+17
-1
17 additions, 1 deletion
src/reducers/project-id.js
with
17 additions
and
1 deletion
src/reducers/project-id.js
+
17
−
1
View file @
8f28ed26
...
...
@@ -38,6 +38,7 @@ const reducer = function (state, action) {
case
TRANSITION_STATE
:
// "from" state must be either an array that includes current project state,
// or null/undefined
debugger
;
if
(
state
.
projectState
in
action
.
transitions
||
ProjectState
.
ANY
in
action
.
transitions
)
{
// const resultState = action.transitions[state.projectState];
switch
(
action
.
transitions
[
state
.
projectState
]
?
...
...
@@ -47,6 +48,18 @@ const reducer = function (state, action) {
projectId
:
action
.
id
,
projectState
:
ProjectState
.
FETCHING_WITH_ID
});
case
ProjectState
.
FETCH_WITH_ID_IF_DIFFERENT
:
if
(
state
.
projectId
===
action
.
id
)
{
// don't re-fetch and reload same data
return
Object
.
assign
({},
state
,
{
projectId
:
action
.
id
,
projectState
:
ProjectState
.
SHOWING_WITH_ID
});
}
// else, it's a new project id, so do fetch it
return
Object
.
assign
({},
state
,
{
projectId
:
action
.
id
,
projectState
:
ProjectState
.
FETCHING_WITH_ID
});
case
ProjectState
.
FETCHING_FILE_UPLOAD
:
// goes straight to LOADING_VM_FILE_UPLOAD
return
Object
.
assign
({},
state
,
{
...
...
@@ -102,7 +115,10 @@ const setProjectId = function (id) {
const
setInitialProjectId
=
id
=>
({
type
:
TRANSITION_STATE
,
transitions
:
{
[
ProjectState
.
NOT_LOADED
]:
ProjectState
.
FETCHING_WITH_ID
[
ProjectState
.
NOT_LOADED
]:
ProjectState
.
FETCHING_WITH_ID
,
// if alreadin in the middle of fetching, just start fetching over
[
ProjectState
.
FETCHING_WITH_ID
]:
ProjectState
.
FETCHING_WITH_ID
,
[
ProjectState
.
SHOWING_WITH_ID
]:
ProjectState
.
FETCH_WITH_ID_IF_DIFFERENT
},
id
:
id
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment