客户端与服务器端存储动态数据

发布于 2025-01-10 06:51:52 字数 232 浏览 1 评论 0原文

假设在前端,我有一个仪表板,其中包含一组用户输入和一个基于这些输入呈现的分页数据表。应用新过滤器或手动刷新数据后,会发送请求以从后端数据库提取数据。但是,如果用户选择数据表上的另一个页面,则不应发送请求从后端数据库获取数据,因为该数据会不断更新。换句话说,当应用新过滤器或用户明确刷新时,仅应显示新数据,而不是在单击不同的表页面时显示。

因此,想知道使用客户端存储(例如索引数据库)来处理最近的请求是否有意义,然后从客户端存储进行分页。

Say on the frontend I have a dashboard with a set of user inputs and a paginated data table that renders based off of those inputs. Upon applying new filters or manually refreshing data, a request is sent to pull data from backend database. However, if the user chooses another page on the data table, no request should be sent to get data from the backend database because that data is constantly updating. In other words, only new data should be shown when new filters are applied or user explicitly refreshes NOT when clicking through different table pages.

So, wondering if using client side storage liked indexed db for the most recent request makes sense here and then paginating from client side storage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌路黄昏 2025-01-17 06:51:52

如果您希望单独的页面基于最新过滤或刷新的数据,那么除非您希望在后端拥有大量版本化数据,否则在客户端分页听起来是不错的选择。

根据数据的大小,索引数据库可能是提高性能的一个不错的选择,但如果您不期望大量数据,那么简单地将响应存储在状态中可能是更简单的解决方案。

If you want separate pages to be based on the data as of the latest filter or refresh, then unless you want to have vast quantities of versioned data on the back-end, paginating on the client side sounds like the way to go.

Depending on the size of your data, Indexed DB could be a great option for performance, but if you aren't expecting large amounts of data, then simply storing the response in state might be the simpler solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文