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.
To do
Step 1: get the form to work with Vulcan API
packages/react-components/components/form/Form/fields.ts
, move the side effect ofhandleFieldPath
(default value setting) somewhere else, to make the function pure./Form
, we have a circular dependency with packages/react-ui/components/form/defaultVulcanComponents.ts, not sure how to fix it... Currently we hard copy the Form folder to Form2 to duplicate the components but that's not very good.... => solution is to split the context provider with default component from the context consumer with the hooks, this avoids having an explicit circular dependencygetLabel
context, eg in packages/react-components/components/form/FormError.tsxwarnOnUnsavecChanges
feature (we need to figure what is thehistory
object exactly + stop triggering the message on page leave. We might need to recode the history.block feature?How to intercept route changes? vercel/next.js#12348
https://github.com/ReactTraining/history/blob/master/docs/blocking-transitions.md
Added beforeRouteChangeStart vercel/next.js#5377
Route cancellation vercel/next.js#2476 (comment)
Browser Back Button does not trigger window.onbeforeunload vercel/next.js#2694
=> ok for browser events. See Listen to route changes in a SPA without tight coupling framework specific router implementation #40 for SPA specific routing, this belongs to Vulcan Next
Step 2: improve the API: better naming, clearer components structure etc.
Others
About custom components
It is already possible to use a custom component as input:
Limitation is that you cannot override this component using the context, it's hard written in your schema.
We could allow something like this:
The advantage of this pattern is that you can change "MyCustomInput" from the context, as other Vulcan inputs. It can be interesting if you want to implement an API that allows some component swapping or programming a multitenant app.
You basically can create your own Vulcan app.
Limitation is that this pattern, which already exists in Vulcan Meteor, tends to be deadly over-used: since the reference to the component is implicit, you may unknowingly create circular dependency, reference a component that doesn't exist etc.
So I am not in a hurry to add this feature. This might need another ticket.