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

View Picker Disappear after select type #6168

Closed
Us3r-gitHub opened this issue Jul 9, 2024 · 5 comments
Closed

View Picker Disappear after select type #6168

Us3r-gitHub opened this issue Jul 9, 2024 · 5 comments

Comments

@Us3r-gitHub
Copy link
Contributor

Bug Description

All.People.-.People.-.Brave.2024-07-09.00-21-23.mp4

Expected behavior

View Picker should be keep visible and adds a new field select when kanban is selected

Copy link
Contributor

greptile-apps bot commented Jul 9, 2024

To fix the issue where the View Picker disappears after selecting a type, follow these steps:

  1. Update ViewPickerCreateOrEditContent.tsx:

    • Ensure the viewPickerMode and viewPickerType states are correctly managed to keep the View Picker visible.
    <Select
      disableBlur
      label="View type"
      fullWidth
      value={viewPickerType}
      onChange={(value) => {
        setViewPickerIsDirty(true);
        setViewPickerType(value);
        // Ensure the View Picker remains visible
        setViewPickerMode('create');
      }}
      options={[
        { value: ViewType.Table, label: 'Table', Icon: IconTable },
        { value: ViewType.Kanban, label: 'Kanban', Icon: IconLayoutKanban },
      ]}
      dropdownId={VIEW_PICKER_VIEW_TYPE_DROPDOWN_ID}
    />
  2. Update useViewPickerStates.ts:

    • Ensure the state management does not reset or hide the View Picker.
    return {
      componentId,
      viewPickerModeState: extractComponentState(viewPickerModeComponentState, componentId),
      viewPickerInputNameState: extractComponentState(viewPickerInputNameComponentState, componentId),
      viewPickerSelectedIconState: extractComponentState(viewPickerSelectedIconComponentState, componentId),
      viewPickerKanbanFieldMetadataIdState: extractComponentState(viewPickerKanbanFieldMetadataIdComponentState, componentId),
      viewPickerReferenceViewIdState: extractComponentState(viewPickerReferenceViewIdComponentState, componentId),
      viewPickerIsPersistingState: extractComponentState(viewPickerIsPersistingComponentState, componentId),
      viewPickerTypeState: extractComponentState(viewPickerTypeComponentState, componentId),
      viewPickerIsDirtyState: extractComponentState(viewPickerIsDirtyComponentState, componentId),
    };
  3. Update ViewPickerCreateOrEditButton.tsx:

    • Ensure the button does not trigger any state changes that hide the View Picker.
    if (viewPickerType === ViewType.Kanban && availableFieldsForKanban.length === 0) {
      return (
        <Button
          title="Go to Settings"
          onClick={navigateToSelectSettings}
          size="small"
          accent="blue"
          fullWidth
          justify="center"
        />
      );
    }

These changes should ensure that the View Picker remains visible after selecting a type and adds a new field select when Kanban is selected.

References

/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerCreateOrEditContent.tsx
/packages/twenty-front/src/modules/views/view-picker/hooks/useViewPickerStates.ts
/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForKanban.ts
/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerCreateOrEditButton.tsx
/packages/twenty-front/src/modules/views/view-picker/components
/packages/twenty-front/src/modules/views/view-picker/hooks
/packages/twenty-front/src/modules/views/view-picker/states

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Ask Greptile · Edit Issue Bot Settings

@FelixMalfait
Copy link
Member

This is strange, I'm not able to reproduce it. I've tried different scenarios, with an object that has a select field, an object without a select field, and it always works for me 🤔. Would you have any idea what could be specific to your use-case? Does it happen on all objects? Thanks

@Us3r-gitHub
Copy link
Contributor Author

I'm not sure what I'm doing

Historical timeline

  1. I want to work on issue Redirect to New Field Page for Kanban Setup #5661
  2. So I created new branch referencing this commit (7aa903a)
    I tried version 0.21 (1c3ea9b) and gave me same bug, maybe you could try it with this version and let me know if you see the same behavior.

Note:

Please run the database reset before starting the server.

@Us3r-gitHub
Copy link
Contributor Author

Currently, in latest commit (6bc3663), I'm facing another issue

image
DB reset is broken (seeder is not running successfully)

image
As a result, when I run server and open application, there is no dummy data

@FelixMalfait
Copy link
Member

@Us3r-gitHub I think this was fixed, if you merge main it should work!

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

2 participants