Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discussion]Should the apps stop instantiating when show/hide the dom? #20

Open
horrylala opened this issue Jun 19, 2019 · 0 comments
Open

Comments

@horrylala
Copy link

horrylala commented Jun 19, 2019

Description

1.Why should the app return a component instance when matched(no mater match path or always alive).

return children && !isEmptyChildren(children)
      ? children
      : matchAnyway
      ? component
        ? componentInstance
        : render
        ? render(props as any)
        : null
      : null

In my opinion, from hide -> show, the very only method is performing SHOW_DOM.But in fact , when i use return null, it will not show or hide dom, but destroyed the dom.

if (matchOfPath) {
      debugLog('--- normal match —‘)
     //***//
    } else {
      debugLog('--- hide match ---')
      // force unmount

      // show ➡️ hide
      if (this.liveState === LiveState.NORMAL_RENDER_MATCHED) {
        this.currentSideEffect = [SideEffect.ON_HIDE_HOOK, SideEffect.SAVE_DOM_SCROLL, SideEffect.HIDE_DOM]
      }
      this.liveState = LiveState.HIDE_RENDER
      **return null**
    }

2.Why should the app instantiate with props using 'match: matchOfPath'?
What does it used for? I use 'this.props' instead of 'props', it still works.

    // normal render
    const props = { ...context, location, match: matchOfPath, ensureDidMount: this.getRouteDom }
    const componentInstance = component && React.createElement(component, props)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant