-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Link to reproduction
No response
Describe the Bug
This takes place while using the live preview for a Globals
config.
Since I'm editing a Globals
config, via live preview and nothing can depend on Globals
, I find it quite questionable that the url /api/pages/
is getting "Too Many Requests"
. The page that the live-preview links to is the same page that one of my /api/pages
links to, but in this instance, that is not the content I am editing.
It should also be noted that the id's for each of the pages being requested there are different pages as well, so it's not like it's only the page I'm currently on. I also don't use any of the page id's in my frontend. I use a "pathnames" field. So, I know that these requests are somehow created by useLivePreview
, or Payload itself.
I know there are a lot of optimizations coming for live-preview. I just wanted to point this out, as it seems to me that live-preview attempts to use all useLivePreview
instances, or something? I'm not really sure how it works under the hood, or what you're currently aware of. However, I don't think we should be able to rate-limit ourselves with live-preview, and it definitely shouldn't be sending requests for data that is not even being edited.
Payload is running separately from my frontend.
cors
and csrf
contain my frontend's url.
here is what my useLivePreview
hook looks like, for my globals:
const { data: companyInfo } = useLivePreview({
serverURL: process.env.NEXT_PUBLIC_CMS_URL,
depth: 2,
initialData: globals.companyInfo,
});
At any given time, 2-3 instances of useLivePreview
are loaded on a page for me. It's unclear to me if that is undesirable. I would have assumed that nothing can happen with an instance of useLivePreview, unless that specific data is edited, though I'm not really sure how payload differentiates which one it should be interacting with. I don't think there is any instance where someone would realistically only have one on a page though? (ie; layout client component, managed with globals and page component(s) managed with a page client component.
To Reproduce
Go to any live-preview field. Enter characters rapidly.
Payload Version
2.0.14
Adapters and Plugins
No response