Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
5aa1b8c8
Commit
5aa1b8c8
authored
Aug 27, 2021
by
Eric Rosenbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store host info in state so the modal doesn't update after reloading managers
parent
a6b7ef3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
src/views/studio/modals/transfer-host-confirmation.jsx
src/views/studio/modals/transfer-host-confirmation.jsx
+17
-10
No files found.
src/views/studio/modals/transfer-host-confirmation.jsx
View file @
5aa1b8c8
...
...
@@ -27,10 +27,17 @@ const TransferHostConfirmation = ({
hostId
,
selectedId
})
=>
{
const
currentHostUsername
=
items
.
find
(
item
=>
item
.
id
===
hostId
).
username
;
const
currentHostImage
=
items
.
find
(
item
=>
item
.
id
===
hostId
).
profile
.
images
[
'
90x90
'
];
const
newHostUsername
=
items
.
find
(
item
=>
item
.
id
===
selectedId
).
username
;
const
newHostImage
=
items
.
find
(
item
=>
item
.
id
===
selectedId
).
profile
.
images
[
'
90x90
'
];
// Initialize host info so it does not get updated after we reload the manager list
const
[
hostInfo
]
=
useState
(()
=>
{
const
currentHostItem
=
items
.
find
(
item
=>
item
.
id
===
hostId
);
const
newHostItem
=
items
.
find
(
item
=>
item
.
id
===
selectedId
);
return
{
currentHostUsername
:
currentHostItem
.
username
,
currentHostImage
:
currentHostItem
.
profile
.
images
[
'
90x90
'
],
newHostUsername
:
newHostItem
.
username
,
newHostImage
:
newHostItem
.
profile
.
images
[
'
90x90
'
]
};
});
const
[
passwordInputValue
,
setPasswordInputValue
]
=
useState
(
''
);
const
[
submitting
,
setSubmitting
]
=
useState
(
false
);
const
[
validationError
,
setValidationError
]
=
useState
(
null
);
...
...
@@ -46,13 +53,13 @@ const TransferHostConfirmation = ({
const
handleSubmit
=
()
=>
{
setSubmitting
(
true
);
handleTransferHost
(
passwordInputValue
,
newHostUsername
,
selectedId
)
handleTransferHost
(
passwordInputValue
,
hostInfo
.
newHostUsername
,
selectedId
)
.
then
(()
=>
handleLoadManagers
(
true
))
// reload the list of managers, to get them in the correct order
.
then
(()
=>
{
handleClose
();
successAlert
({
id
:
'
studio.alertTransfer
'
,
values
:
{
name
:
newHostUsername
}
values
:
{
name
:
hostInfo
.
newHostUsername
}
});
})
.
catch
(
e
=>
{
...
...
@@ -86,8 +93,8 @@ const TransferHostConfirmation = ({
className=
"transfer-outcome-tile"
key=
{
hostId
}
id=
{
hostId
}
image=
{
currentHostImage
}
username=
{
currentHostUsername
}
image=
{
hostInfo
.
currentHostImage
}
username=
{
hostInfo
.
currentHostUsername
}
isCreator=
{
false
}
/>
</
div
>
...
...
@@ -103,8 +110,8 @@ const TransferHostConfirmation = ({
className=
"transfer-outcome-tile"
key=
{
selectedId
}
id=
{
selectedId
}
image=
{
newHostImage
}
username=
{
newHostUsername
}
image=
{
hostInfo
.
newHostImage
}
username=
{
hostInfo
.
newHostUsername
}
isCreator=
{
false
}
/>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment