couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowalski <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Allow editing documents from view
Date Mon, 15 Dec 2014 14:22:14 GMT
Github user robertkowalski commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/192#issuecomment-67000202
  
    @michellephung @benkeen hi! michelle provided me some steps to reproduce the double rendering/afterRender-called-twice-issue.
Thanks a lot! Here are the step to reproduce for reference:
    
    ```
    1. Place a console.log in the afterRender of the view in question.
    2. Click on a view, (in the sidebar)
    3. Click edit on one of the design-documents shown
    4. Click ‘Back’
    5. Look at the console to see that it is called twice
    ```
    
    here is what happens: in `afterRender` a `triggerRouteEvent` for the queryOptions is called
(see https://github.com/michellephung/couchdb-fauxton/blob/2494-allow-editing-docs-from-view/app/addons/documents/views-index.js#L452).
This will end up in the core, triggering a render, causing the view to render twice (or without
the hack, infinitely): see https://github.com/apache/couchdb-fauxton/blob/master/app/core/router.js#L115
    
    Instead of fixing that with different workarounds I propose to fix the root cause: please
change the `triggerRouteEvent` to a "normal" event-trigger which passes the options to the
queryoptions component (using `FauxtonAPI.trigger` and `this.listenTo`).
    
    After that we can remove the `hasRenderedOnce` and also the test for empty markup and
don't need any hacks.
    
    I am happy to help if there are questions!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message