[WIP] API Enable support for extensions to get anchor links #2675
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue silverstripe/silverstripe-elemental#796
Related PR silverstripe/silverstripe-elemental#911
Note: seems like the AnchorSelectField javascript only currently works now because something is a bit broken and prevents the response get cached in the redux state
props.loadingState === anchorSelectorStates.DIRTY
for regular pagesFor BlockPages, its always
anchorSelectorStates.SUCCESS
, so the cached "response" of an empty array is used. Now response is actually made though, I think it's just the initial state.I think all this may be because Elemental is more 'plugged into' the react/redux/apollo way of doing this that it "works"
Simply removing the caching allowed a BlockPage to actually fetch from the endpoint
There's currently some code in AnchorSelectField.mapStateToProps that looks little non-standard? I'm somewhat inclined to just remove it all. Anchor links on pages are currently not cached, and this is causing no real issues.
Previously the BlockPage was trying to fetch from
/admin/methodSchema/Modals/editorAnchorLink/6
The correct URL is
/admin/Modals/editorAnchorLink/6/field/Anchor/anchors/2