Skip to content

fix: use cloneDeep for proxy objects#18436

Merged
Antreesy merged 2 commits into
mainfrom
fix/noid/str-clone-proxy
Jun 26, 2026
Merged

fix: use cloneDeep for proxy objects#18436
Antreesy merged 2 commits into
mainfrom
fix/noid/str-clone-proxy

Conversation

@Antreesy

@Antreesy Antreesy commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

☑️ Resolves

  • Fix chat rendering in Desktop client

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

🖌️ UI Checklist

🖼️ Screenshots / Screencasts

🏚️ Before 🏡 After
2026-06-25_14h55_11 👍🏽

🏁 Checklist

  • 🌏 Tested with different browsers / clients:
    • Chromium (Chrome / Edge / Opera / Brave)
    • Firefox
    • Safari
    • Talk Desktop
    • Integrations with Files sidebar and other apps
    • Not risky to browser differences / client
  • 🖌️ Design was reviewed, approved or inspired by the design team
  • ⛑️ Tests are included or not possible
  • 📗 User documentation in https://github.com/nextcloud/documentation/tree/master/user_manual/talk has been updated or is not required

@Antreesy Antreesy added this to the ⛅ Next Major (35) milestone Jun 25, 2026
@Antreesy Antreesy requested a review from ShGKme June 25, 2026 12:57
@Antreesy Antreesy self-assigned this Jun 25, 2026
@Antreesy

Copy link
Copy Markdown
Contributor Author

/backport to stable34

Comment thread src/services/CapabilitiesManager.ts Outdated
Comment on lines +226 to +227
const config = structuredClone(object.config)
const config = structuredClone(toRaw(object.config))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing Vue and having a reactive object is unexpected in capabilities manager to me. Does it actually happen?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's a plain object (though it's nested)

*/
function createCombinedSystemMessage({ id, messages, type, collapsed }) {
const combinedMessage = structuredClone(messages[0])
const combinedMessage = structuredClone(toRaw(messages[0]))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the message isn't a flat object, we need either recursive toRaw or cloneDeep from es-toolkit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra 3.5 kB, doesn't sound bad

Comment thread src/store/messagesStore.js Outdated
Antreesy added 2 commits June 26, 2026 10:00
- structuredClone() can not be called on Proxy
- es-toolkit adds 3.5 kB to size

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
@Antreesy Antreesy force-pushed the fix/noid/str-clone-proxy branch from 6e91d7d to 8294fb4 Compare June 26, 2026 08:00
@Antreesy Antreesy requested a review from ShGKme June 26, 2026 08:03
@Antreesy Antreesy changed the title fix: clone direct object instead of proxy fix: use cloneDeep for proxy objects Jun 26, 2026
@Antreesy Antreesy merged commit 11bbcde into main Jun 26, 2026
54 checks passed
@Antreesy Antreesy deleted the fix/noid/str-clone-proxy branch June 26, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants