Custom views/app.js

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • a.slyzhko
    Member
    • Oct 2023
    • 90

    Custom views/app.js

    Hi!

    I want to override requestUserData method in app class. I want to add some data to cache after this method has executed.
    The question is how can I define new path "custom:views/app" like we do with entity views?
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi,

    There's no official way to override core classes. It's on purpose, the official way of extending is we giving guaranties that the customization is future proof (to an extent).

    You can try monkey patching, but I don't recommend. https://forum.espocrm.com/forum/deve...avascript-code
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • a.slyzhko
      Member
      • Oct 2023
      • 90

      #3
      I got you. Maybe there is another way to set this data? The problem is as follows: I have relation with user, which is changed very rarely, but also I use this data, when rendering buttons on different views, so I want to set it to cache once the user is set to lighten load on back-end and client rendering
      Last edited by a.slyzhko; 01-12-2024, 09:55 AM.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        Use App Params. https://docs.espocrm.com/development/app-params/. If you want to cache, cache it on the backend and serve the cached value.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • a.slyzhko
          Member
          • Oct 2023
          • 90

          #5
          Do I have to just inject Psr\Cache\CacheItemPoolInterface to use cache?

          Comment

          • yuri
            Member
            • Mar 2014
            • 8440

            #6
            We don't support CacheItemPoolInterface. Consider Espo\Core\Utils\DataCache.
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            • a.slyzhko
              Member
              • Oct 2023
              • 90

              #7
              Cool, thank you very much!

              Comment

              Working...