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

I should be able to filter on workspaceMember = me #8016

Open
FelixMalfait opened this issue Oct 23, 2024 · 20 comments
Open

I should be able to filter on workspaceMember = me #8016

FelixMalfait opened this issue Oct 23, 2024 · 20 comments
Assignees
Labels
prio: med scope: front Issues that are affecting the frontend side only

Comments

@FelixMalfait
Copy link
Member

FelixMalfait commented Oct 23, 2024

Context

In #7196 we introduce "variable filters" such as "today" or "in the future", in which the frontend dynamically replaces the value before throwing the query.

Current behavior

Screenshot 2024-10-23 at 22 41 07

Desired behavior

We would like to introduce a "current user" option for workspaceMember relations, for example assignee on Tasks.

See how Linear is also doing it:

Screenshot 2024-10-23 at 22 43 43

Figma

  • Change no owner icon to circle-dashed-x
  • The text for "is empty" should be no field-name e.g no owner, no assignee...
  • Create a new me value with user-circle icon

CleanShot 2024-10-24 at 13 46 55

https://www.figma.com/design/xt8O9mFeLl46C5InWwoMrN/Twenty?node-id=43752-81861&node-type=instance&t=tFDldeynurqAJQpp-11

@FelixMalfait FelixMalfait added scope: front Issues that are affecting the frontend side only prio: med labels Oct 23, 2024
@sanjay-gangwar4410
Copy link

/assign

Copy link

oss-gg bot commented Oct 24, 2024

This issue is not part of oss.gg hackathon. Please pick a different one or start with a side quest

@ketanMehtaa
Copy link
Contributor

assign me if sanjay is not working on this .

@sanjay-gangwar4410
Copy link

i am not working on it . you (@ketanMehtaa )can work on it

@FelixMalfait
Copy link
Member Author

/oss.gg 1000

Copy link

oss-gg bot commented Oct 24, 2024

Thanks for opening an issue! It's live on oss.gg!

Copy link

oss-gg bot commented Oct 24, 2024

This issue is already assigned to another person. Please find more issues here.

1 similar comment
Copy link

oss-gg bot commented Oct 27, 2024

This issue is already assigned to another person. Please find more issues here.

@NabidAkhtar
Copy link

@sanjay-gangwar4410 please unassign yourself, if you are not working.

@antilpiyush89
Copy link

/assign

Copy link

oss-gg bot commented Oct 28, 2024

This issue is already assigned to another person. Please find more issues here.

@DanishAliUmar
Copy link

/assign

Copy link

oss-gg bot commented Oct 28, 2024

This issue is already assigned to another person. Please find more issues here.

@prithak01
Copy link

/assign

Copy link

oss-gg bot commented Oct 30, 2024

This issue is already assigned to another person. Please find more issues here.

@eliasylonen
Copy link
Contributor

Some rubber ducking / notes:

I need to add something like CURRENT_WORKSPACE_MEMBER as a possible filter value for RELATION filters, and convert it into a workspace member id in resolveFilterValue.

To do this, resolveFilterValue needs to know the id of current workspace member.

I think passing currentWorkspaceMemberId to resolveFilterValue as a parameter is not a very elegant long-term solution, because resolveFilterValue might need many more similar parameters in the future when more "variable" filters (like PAST_3_WEEKS for DATE filters and CURRENT_WORKSPACE_MEMBER for RELATION filters) are added.

I think it would be good to wrap resolveFilterValue with a hook (e.g. useResolveFilterValue) to avoid having to supply all its dependencies as parameters.


TODO - continuing here tomorrow: Is there any reason against wrapping all functions where resolveFilterValue is used with hooks to be able to use the useResolveFilterValue hook inside them? Probably no.


In the long term I think the most elegant solution would be to call the useResolverFilterValue hook as early as possible: The current Filter type could be changed to contain the resolved filter value instead of the unresolved value from the original ViewFilter. That way filtering-related components would not have to do any value resolving at all, they could just always use the resolved value.

Downside: That would be a bigger refactoring than I first thought.

@FelixMalfait
Copy link
Member Author

Thanks @eliasylonen!

@lucasbordeau
Copy link
Contributor

lucasbordeau commented Dec 9, 2024

@eliasylonen We most probably shouldn't work at this abstraction level and instead focus on trying to turn every specific hard coded case into a generic record filter so that all this low-level generic logic isn't aware of anything we're doing above it.

CURRENT_WORKSPACE_MEMBER is just something high level to indicate that we want to add a filter id on workspaceMember, which is something generic that can be stored as a filter like anything related to this in the future.

We should work on something like an adapter that turns everything into a generic record filter

@eliasylonen
Copy link
Contributor

I'll refactor filtering to work like this:

  1. Get view filters from backend.
  2. Create a recoil selector that returns two arrays: variable filters and static filters.
  3. Use variable filters and static filters in components as needed.
  4. Convert static filters into a GraphQL query.

@eliasylonen
Copy link
Contributor

@lucasbordeau
Some context for today's call, but no need to prep! I have a list of questions ready

Filter value resolution in object filter component:
eliasylonen@354c94a

Passing current workspace member id to the util function that generates the GraphQL query - I think a hook would be better?
eliasylonen@d86416a

eliasylonen added a commit that referenced this issue Dec 23, 2024
New branch based on feedback in PR #8950 and issue #8016

---------

Co-authored-by: ad-elias <[email protected]>
Co-authored-by: Lucas Bordeau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: med scope: front Issues that are affecting the frontend side only
Projects
Status: 🆕 New
Development

No branches or pull requests

10 participants