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: Improved Image Deletion Logic, Image ID Issue in Modals and Performance Optimization in Editor #2092

Merged
merged 4 commits into from
Sep 7, 2023

Conversation

Palanikannan1437
Copy link
Collaborator

@Palanikannan1437 Palanikannan1437 commented Sep 4, 2023

Summary

Here I focus on resolving three issues:

  1. The first issue addressed is the range errors experienced during bulk image deletion from S3.
  2. The second issue pertains to the random changes in image IDs between two transactions in modals.
  3. Really bad Time Complexity during checking for deleted image nodes hence really bad performance concerns in large docs.

The changes proposed significantly improve the time complexity of checking if a node still exists in the new state, from O(n) to O(1).

Background

The original S3 image deletion logic involved a complex process that included iterating through all nodes in the old state, checking for image nodes, and then traversing the entire new state for each node in the old state. This process was not only complex but also inefficient with a time complexity of O(n). Moreover, issues were encountered with image IDs changing randomly between two transactions in modals.

Solution

The solution implemented:

  1. Adds a check to see if the old node’s position is greater than the current document's size, which helps avoid range errors during bulk image deletion.
  2. The issue with image IDs changing randomly between two transactions in modals has been resolved using source instead as the unique identifier.
  3. We now maintain a set of all image node sources in the new state's document. This allows us to check if a node still exists in the new state with a time complexity of O(1), instead of traversing the entire new state for each node in the old state.

Demo

modal.issue.mov

Additional stuff

Solved a regression issue with Code blocks support with Syntax highlighting.

@vercel
Copy link

vercel bot commented Sep 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

6 Ignored Deployments
Name Status Preview Comments Updated (UTC)
plane ⬜️ Ignored (Inspect) Visit Preview Sep 5, 2023 3:57am
plane-dev ⬜️ Ignored (Inspect) Visit Preview Sep 5, 2023 3:57am
plane-sh ⬜️ Ignored (Inspect) Visit Preview Sep 5, 2023 3:57am
plane-sh-dev ⬜️ Ignored (Inspect) Visit Preview Sep 5, 2023 3:57am
plane-sh-stage ⬜️ Ignored (Inspect) Visit Preview Sep 5, 2023 3:57am
plane-staging ⬜️ Ignored (Inspect) Visit Preview Sep 5, 2023 3:57am

@srinivaspendem srinivaspendem added this to the 0.12.1-dev milestone Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working 🌟enhancement New feature or request 🎨UI / UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug]: plane sends requests on every keystroke
3 participants