mikebridge commented on PR #44452:
URL: https://github.com/apache/superset/pull/44452#issuecomment-6083701720

   @geido Thanks — that suggestion found a real bug, not just a coverage gap.
   
   Writing the test you asked for showed that a switch between two semantic 
views of the *same* type kept serving the previous view's capabilities: 
`isServerPaginationUnsupported` only checked `datasource.type === 
datasourceType`, which stays true across a same-type switch, so a stale 
`ROW_OFFSET` from the prior view enabled pagination before the selected view's 
metadata had arrived. The existing cases all changed datasource *type*, which 
is exactly why they missed it.
   
   Fixed in the push just now (`5e2b689661`): capability metadata is read only 
when `datasource.uid === form_data.datasource`, so unmatched metadata now 
behaves like pending metadata — pagination stays conservatively disabled until 
the selected view declares offset support.
   
   Tests, three per plugin in `plugin-chart-table/test/controlPanel.test.tsx` 
and `plugin-chart-ag-grid-table/test/controlPanel.test.tsx`:
   
   - `%s ignores stale offset capability from another semantic view` — your 
scenario, `1__semantic_view` metadata against a `2__semantic_view` selection, 
for both `server_pagination` and `server_page_length`; it also asserts the 
control value is not silently reset.
   - `ignores stale offset capability when switching opaque semantic UIDs` — 
the same thing for provider UIDs that don't encode a parseable type 
(`cube__orders` → `cube__customers`), which the old code treated as a 
non-semantic datasource and left pagination enabled.
   
   All six fail against the previous helper. Both control-panel suites are 
green at this commit (61/61).
   
   One adjacent thing I noticed while verifying, worth your view as a follow-up 
rather than something for this PR: `resetLabel` is still gated on 
`state.datasource` merely existing rather than on the UID match, so during that 
same switch the control is correctly disabled but we also offer "Turn off 
server pagination" and say "This semantic view does not support server 
pagination" — both based on the previous view's metadata. The `datasource: 
null` case is handled, but the stale case isn't. Happy to open a separate issue 
for it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to