Giter Club home page Giter Club logo

Comments (6)

greptile-apps avatar greptile-apps commented on August 18, 2024

To resolve the issue where the view becomes blank after deleting a select field, follow these steps:

  1. Modify view deletion logic:

    • Update the useViews, useViewFilters, and useViewSorts hooks to handle the deletion of views when the associated select field is deleted. Ensure that these hooks check for the existence of the select field and remove the corresponding views if the field is deleted.
  2. Add confirmation window:

    • Update the ViewPickerCreateOrEditContent and ViewPickerCreateOrEditContentEffect components to include a confirmation window. This window should inform the user about the views that will be removed when the select field is deleted.

Example code snippets:

useViews.js:

// Add logic to delete views associated with the deleted select field
useEffect(() => {
  if (deletedSelectField) {
    const updatedViews = views.filter(view => view.fieldId !== deletedSelectField.id);
    setViews(updatedViews);
  }
}, [deletedSelectField]);

ViewPickerCreateOrEditContent.js:

// Add confirmation window logic
const handleDeleteSelectField = (fieldId) => {
  const affectedViews = views.filter(view => view.fieldId === fieldId);
  if (affectedViews.length > 0) {
    if (window.confirm(`Deleting this field will remove ${affectedViews.length} views. Do you want to proceed?`)) {
      deleteSelectField(fieldId);
    }
  } else {
    deleteSelectField(fieldId);
  }
};

Ensure these changes are integrated into the respective files and tested for the described scenario.

References

Edit Issue Bot Settings

from twenty.

Bonapara avatar Bonapara commented on August 18, 2024

@Weiko #6028 may be related to this one too if you have any inputs?

from twenty.

Us3r-gitHub avatar Us3r-gitHub commented on August 18, 2024

The mentioned issue will be the next impact if this is not addressed/fixed

After this object field deletion and navigate back to view again

from twenty.

ijreilly avatar ijreilly commented on August 18, 2024

@Bonapara is it ok to delete the view directly when deleting the field, or should we add a modal when deleting the field to warn that the view will be deleted ?

from twenty.

Bonapara avatar Bonapara commented on August 18, 2024

We can delete it directly, at least for now!

from twenty.

gitstart-app avatar gitstart-app commented on August 18, 2024

Here is the GitStart Ticket for this issue: https://clients.gitstart.com/twenty/5449/tickets/TWNTY-6027

from twenty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.