Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Copy as K8s #2517

Merged
merged 2 commits into from
Apr 30, 2024
Merged

fix: Copy as K8s #2517

merged 2 commits into from
Apr 30, 2024

Conversation

johncowen
Copy link
Contributor

@johncowen johncowen commented Apr 29, 2024

See #2374 (comment)

Looks like this is one of those cases where we need to make sure we await for a promise and return its result rather than just return the promise to be awaited on elsewhere.

Probably why the original code was like:

let res: Entity
try {
res = await p
} finally {
p = new Promise((resolve, reject) => { copy.value = (cb) => cb(resolve, reject) })
}
return res

But we've lost that detail through lack some good comments and subsequent upgrades/refactors there. I'll probably either refactor this code slightly to make this clearer or add some clearer comments. Putting the PR up whilst I think about that a little.

As little sidenote: I really wanted to progress the dev time clipboard coping debug I added here #1981 into something we could also use for testing clipboard interactions.

Unfortunately we removed the clipboard debugging here #2374, but this PR shows why it would be good to get that back in and then also progressed into something we can use for e2e tests.

Closes #2513

Signed-off-by: John Cowen <john.cowen@konghq.com>
@johncowen johncowen requested a review from a team as a code owner April 29, 2024 15:13
@johncowen johncowen requested review from kleinfreund and removed request for a team April 29, 2024 15:13
Copy link

netlify bot commented Apr 29, 2024

Deploy Preview for kuma-gui ready!

Name Link
🔨 Latest commit fbef4d1
🔍 Latest deploy log https://app.netlify.com/sites/kuma-gui/deploys/6630b2f3df5afe0008008b79
😎 Deploy Preview https://deploy-preview-2517--kuma-gui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: John Cowen <john.cowen@konghq.com>
@johncowen
Copy link
Contributor Author

I added the most minimal of comments here so we had something, I want to merge all our 3 CodeBlock components into one at some point anyway, so I guess I'll be back here at some point soonish, I can make things clearer then.

@johncowen johncowen merged commit 6f8fed6 into kumahq:master Apr 30, 2024
15 checks passed
@johncowen
Copy link
Contributor Author

This wasn't the fix in the end see #2513 (comment)

Actual fix #2531

johncowen added a commit that referenced this pull request May 21, 2024
We have some places where we need eXtra eXtensions on top of KCopy

This adds a thin wrapper over KCopy and builds things out so we can use XCopyButton (née KCopy) everywhere without it being problematic.

I've kept `TextWithCopyButton` at least temporarily but it now just wraps over `XCopyButton`. We use `TextWithCopyButton ` quite a lot so I haven't gone through and search/replaced all the usages, I may do that here and then also `TextWithCopyButton` so we only have one copy button thing.

I also added back in our clipboard debugging tooling that I originally added in #1981 and was removed in #2374 

Last, I originally called this `XCopy` (like `KCopy`), but then realized this problem was probably caused by this naming (no explicit `*Button`) so I called it `XCopyButton` to make it clear this is a button and doesn't need to be/shouldn't be wrapped in another button

Closes #2513

Related: #2517 (<== I thought this was a fix but it wasn't)

Signed-off-by: John Cowen <john.cowen@konghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Copy as K8s" no longer works
2 participants