Giter Club home page Giter Club logo

Comments (7)

jardakotesovec avatar jardakotesovec commented on August 16, 2024

@ewhanson This should resolve the workaround you are having in OrcidForm.vue. What you think?

ui-library: pkp/ui-library#357

from pkp-lib.

ewhanson avatar ewhanson commented on August 16, 2024

Hey @jardakotesovec, thanks for this! I think this gets most of the way to solving my issues. It is possible to save a form with conditionally hidden required elements blank, but if there are previous errors, they are not dismissed when the fields are hidden (see video).

orcid_settings.mp4

from pkp-lib.

jardakotesovec avatar jardakotesovec commented on August 16, 2024

@ewhanson Ok.. additionally added removing error on field unmount, which can be think about as clean up for field which is not relevant anymore.

At this point I think this should work well.. can't think of where it could cause problems at this point.. but if you can think of something please let me know!

from pkp-lib.

ewhanson avatar ewhanson commented on August 16, 2024

Thanks @jardakotesovec! This is most of the way there now, but I'm still running into an error. It seems that only one error is removed at a time when the components are unmounted. I have an example where there are 3 "required fields not completed" errors. And each time I hide/unmount the components, another one of the errors is removed.

orcid.mp4

from pkp-lib.

jardakotesovec avatar jardakotesovec commented on August 16, 2024

@ewhanson Great catch, thanks! I did not test it with more than one field, so I did not notice it.

It went wrong, because how the state management is structured currently there. So every removing error created new errors object with that one error removed. But the errors object prop don't get propagated between these calls.. so all of them were modifying the original object and basically last change win.

Not fan of the solution I end up with.. hence the long comment in the code.. but it does work and I still think that this is how it should behave and it should remove the errors if the field gets removed.

from pkp-lib.

ewhanson avatar ewhanson commented on August 16, 2024

Hey @jardakotesovec, that makes sense. I've done some testing with the latest changes and it's working as expected now. 👍

from pkp-lib.

jardakotesovec avatar jardakotesovec commented on August 16, 2024

@ewhanson Thank you, merged.

from pkp-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.