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

Load views on user load and read in cache #3552

Merged
merged 7 commits into from
Jan 22, 2024

Conversation

thomtrp
Copy link
Contributor

@thomtrp thomtrp commented Jan 19, 2024

This PR:

  • load views on current user load. We cannot use a fragment since Views are not a custom object. We will have to maintain de fields for now
  • a hook to fetch the root query in cache. The views will be automatically stored in there
  • instead of redirecting to /company link on root path and wait for the view id, we can now build directly the path with the view id in params
  • when building the links in settings, read the view cache first and build the links with the view id param

@thomtrp thomtrp force-pushed the tt-load-views-and-store-in-cache branch 2 times, most recently from 08e6d42 to 8630aea Compare January 19, 2024 14:22

export const useCachedRootQuery = ({
objectMetadataItem,
isArrayOfRecords,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big fan if isArrayOfRecords, we should stick to the query api: { query: findMany | findOne }. We would likely also pass query variables at some point

isArrayOfRecords: true,
});

const { records } = useFindManyRecords({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, the API is not that bad!

}
}
}
views {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

later we should generate this from our mapMetadataToQuery hooks but this would require to have the system standard object available in the FE no matter if we have fetched /metadata already or not. We could also leverage fragment for this part

@charlesBochet
Copy link
Member

@thomtrp We are missing the piece on the backend. I've added it

@thomtrp thomtrp force-pushed the tt-load-views-and-store-in-cache branch from e4e3f45 to 12ce196 Compare January 22, 2024 12:42
Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@thomtrp thomtrp merged commit f1b3d15 into main Jan 22, 2024
13 checks passed
@thomtrp thomtrp deleted the tt-load-views-and-store-in-cache branch January 22, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants