nonexistent object despite using app.validation_layout

Viewed 112

I'm trying to rewrite an App following this documentation so that it supports multiple pages. I'm running into issues porting my URL parsing behavior. I have a drop down table that is added in a later layout and the user can select values which updates a shareable URL. This table is also specified in app.validation_layout so I'm confused as to why this is throwing a non-existent error.

Error I'm seeing:

A nonexistent object was used in an `Input` of a Dash callback. The id of this object is `points-dropdown` and the property is `value`. The string ids in the current layout are: [url, page-content]

index.py

BASE_HTML = html.Div([
  dcc.Location(id='url', refresh=False),
  dcc.Link('Home', href='/'),
  html.Br(),
  dcc.Link('Live Data', href='/live/'),
  html.Br(),
  html.Div(id='page-content')
])

app.layout = BASE_HTML
app.validation_layout = html.Div([
    BASE_HTML,
    live.LAYOUT,
])

@app.callback(Output('page-content', 'children'),
              Input('url', 'pathname'))
def URLRouting(pathname):
  if pathname == '/live/':
    return live.LAYOUT


@app.callback(
  Output('url', 'href'),
  Input('url', 'href'),
  Input('points-dropdown', 'value'),
  prevent_initial_call=True,
)
def UpdateURL(href, points):
  args = {'points': points}
  return urllib.parse.urljoin(href, urllib.parse.urlencode(args, doseq=True))

live.py

POINTS_COLUMNS = queries.GetPointsColumns()

LAYOUT = html.Div([
    html.H3('Live Data'),
    dcc.Dropdown(
      id='points-dropdown',
      options=[{'label': i, 'value': i} for i in POINTS_COLUMNS],
      clearable=False,
      multi=True,
    ),
])

This commit provides a nice delta of what I'm attempting. https://github.com/djhedges/exit_speed/commit/186f0abad7fb7cd2b683605b917920c46c3dcd5e#diff-66cd9688a2ae068244ea01e70f0e230f5623b7fa4cdecb65070a09ec06452262

0 Answers
Related