Replies: 1 comment 5 replies
-
Did you ever resolve this? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm back after going down a bit of a rabbit hole.
TL;DR:
Relationship.tsx
from the Payload repository.dist
instead of relative paths.I have two new problems that occur depending on minor changes to a single import.
The useEffect race condition
If I use
import optionsReducer from 'payload';
, when the field loads, it errors because the effect that loads therelationTo
docs from the API finishes AFTERfindOptionsByValue({ value, options });
is called. So the options property is empty when it hits aforEach
.I noticed that the import for the
optionsReducer
was coming frompayload
whereas all my other imports were coming from the dist folder.I changed the import to
import optionsReducer from 'payload/dist/admin/components/forms/field-types/Relationship';
and that caused...No matched field found for "foo"
When the page loads, there is no error, but instead of the relationship field, I see the message
No matched field found for "Categories"
.In
RenderFields/index.tsx
,let FieldComponent = fieldTypes[field.type];
doesn't seem to be finding my component any more.I've no idea how to investigate this further so if anyone could help, that would be brilliant. Here's a repository with my current set up: https://github.com/RapidOwl/payload-custom-component
Beta Was this translation helpful? Give feedback.
All reactions