Skip to content
Snippets Groups Projects

Persist submission form values with apollo-link-state

Merged Aanand Prasad requested to merge persist-submission-state into master
2 unresolved threads

To try it out:

  1. On the dashboard, click "Submit a manuscript"
  2. Fill out the form
  3. Click "Next"
  4. On the file upload dummy page, click "Author details" to return to the form
  5. The values you entered should still be there
Edited by Aanand Prasad

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
27 27 })
28 28
29 29 const empty = {
30 __typename: 'Submission',
  • What does this do?

  • Author Maintainer

    I'm so glad you asked. Since everything is GraphQL, everything is supposed to be "sent" (even if it's just to the in-memory cache) with a __typename. Omitting it doesn't seem to break it, but it does generate warnings, so I'm on the fence about whether to include it or not.

  • Please register or sign in to reply
  • Tamlyn Rhodes
    Tamlyn Rhodes @tamlyn started a thread on an outdated change in commit cd27131e
  • 13 15 const store = configureStore(history, {})
    14 16
    17 const makeApolloConfig = ({ cache, link, ...config }) => {
    18 const clientStateLink = withClientState({
    19 cache,
    20 resolvers: {
    21 Mutation: {
    22 updateCurrentSubmission: (_, { input }, { cache }) => {
    23 cache.writeData({ data: { currentSubmission: JSON.parse(input) } })
    24 return null
    25 },
    26 },
    27 },
    28 defaults: {
    29 currentSubmission: empty,
    30 },
  • Aanand Prasad changed title from WIP: Persist submission state to WIP: Persist submission form values with apollo-link-state

    changed title from WIP: Persist submission state to WIP: Persist submission form values with apollo-link-state

  • Aanand Prasad added 6 commits

    added 6 commits

    Compare with previous version

  • Aanand Prasad changed the description

    changed the description

  • Aanand Prasad added 1 commit

    added 1 commit

    • 44bb22c3 - refactor: put apollo-link-state config in the schema file

    Compare with previous version

  • Aanand Prasad added 1 commit

    added 1 commit

    • a66e945b - refactor: remove JSON parsing/serialization

    Compare with previous version

  • Aanand Prasad changed the description

    changed the description

  • Aanand Prasad added 1 commit

    added 1 commit

    • b62c9738 - refactor: remove premature cleverness

    Compare with previous version

  • Aanand Prasad added 9 commits

    added 9 commits

    • b62c9738...ff1ee3bd - 4 commits from branch master
    • c76670ff - feat: persist author details in Apollo cache
    • 578a4b72 - refactor: put apollo-link-state config in the schema file
    • 6b46b670 - refactor: remove JSON parsing/serialization
    • 1f166e87 - refactor: remove premature cleverness
    • 262f9b80 - fix: ensure state is saved before redirecting

    Compare with previous version

    Toggle commit list
  • Aanand Prasad unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Aanand Prasad changed the description

    changed the description

  • Aanand Prasad added 1 commit

    added 1 commit

    • 52db1874 - fix: log graphql errors to the console

    Compare with previous version

  • merged

  • Tamlyn Rhodes mentioned in commit 145c5d3b

    mentioned in commit 145c5d3b

  • Please register or sign in to reply