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

[UI] Overlays.tsx not setting draggable elements in production when using useOptimistic #2088

Open
JohnGemstone opened this issue Nov 4, 2024 · 0 comments

Comments

@JohnGemstone
Copy link

JohnGemstone commented Nov 4, 2024

When using useOptimistic to update draggable array components, items are no longer set as draggable in the overlay.
This only occurs in a production build, in dev it works as expected.

To Reproduce

  1. Set up an array builder like the one found in the page-builder-demo
  2. Run dev, observe draggable items
  3. Build and run start, observe items no longer draggable
  4. Remove useOptimistic
  5. Build and run start, observe draggable items, with no optimistic updates.

Expected behavior
Draggable items with client-side updates in production

Screen Recordings
Dev server (with useOptimistic): ✅

draggable-dev.mov

Prod server (with useOptimistic): ❌

draggable-prod.mov

Prod server (without useOptimistic): ✅

draggable-prod-non-optimistic.mov

Note: ignore the repeated fading to black related to #2087

Which versions of Sanity are you using?

@sanity/cli (global)        3.62.3 (up to date)
@sanity/assist               3.0.8 (up to date)
@sanity/icons                3.4.0 (up to date)
@sanity/image-url            1.1.0 (up to date)
@sanity/mutate              0.10.1 (up to date)
@sanity/presentation        1.17.7 (up to date)
@sanity/preview-url-secret   2.0.0 (up to date)
@sanity/util                3.62.3 (up to date)
@sanity/vision              3.62.3 (up to date)
@sanity/visual-editing       2.4.2 (up to date)
sanity                      3.62.3 (up to date)

What operating system are you using?
OSX + Chrome

Which versions of Node.js / npm are you running?
v22.0.0

Additional context

When testing I found that the useOptimistic hook is somehow messing with useOptimisticActorReady in production since optimisticActorReady gets set to false when it's used:

const optimisticActorReady = useOptimisticActorReady()

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

No branches or pull requests

1 participant