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

fix: Address database options prepopulated with stale option, in dataset component #27797

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jzhao62
Copy link

@jzhao62 jzhao62 commented Apr 1, 2024

SUMMARY

  • the previous practice involves auto auto populate database (stored in local storage) into the newly created dataset, which will create bugs when database name changes, database is deleted, or when database meta is changed.
  • the practice of saving and fetching latest modified database through localStorage is a potentially technical debut, making it easy to introduce regression that cannot be tracked. looking to potential bugs next.
    BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
    stale database data in localStorage
    image

after fix demo
https://github.com/apache/superset/assets/25937657/8a20d1dc-cdb9-47a2-8cac-7d84b16eaa5a
TESTING INSTRUCTIONS
connect a database of your choice,
rename your database
create a new dataset, and you will see the option not prepopulated.
ADDITIONAL INFORMATION
[ x] Has associated issue: Fix #27266
Required feature flags:
Changes UI
Includes DB Migration (follow approval process in #13351)
Migration is atomic, supports rollback & is backwards-compatible
Confirm DB migration upgrade and downgrade tested
Runtime estimates and downtime expectations provided
Introduces new feature or API
Removes existing feature or API

@jzhao62 jzhao62 changed the title fix(dataset): Address database options prepopulated with stale databa… fix: Address database options prepopulated with stale option, in dataset component Apr 1, 2024
@pull-request-size pull-request-size bot added size/M and removed size/XS labels Apr 6, 2024
@jzhao62
Copy link
Author

jzhao62 commented Apr 6, 2024

@justinpark add some lines to fix testcases, please take a look

@rusackas
Copy link
Member

rusackas commented Jul 9, 2024

Adding @michael-s-molina as reviewer since he was trying to repro the issue (#27266) a while back. Also, closing/reopening this PR to kick-start the CI process.

@rusackas rusackas closed this Jul 9, 2024
@rusackas rusackas reopened this Jul 9, 2024
Copy link

codecov bot commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.78%. Comparing base (1d571ec) to head (2342587).
Report is 831 commits behind head on master.

Files Patch % Lines
...c/features/datasets/AddDataset/LeftPanel/index.tsx 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #27797      +/-   ##
==========================================
+ Coverage   69.69%   69.78%   +0.09%     
==========================================
  Files        1908     1956      +48     
  Lines       74530    76797    +2267     
  Branches     8309     8975     +666     
==========================================
+ Hits        51942    53594    +1652     
- Misses      20535    21004     +469     
- Partials     2053     2199     +146     
Flag Coverage Δ
javascript 58.05% <50.00%> (+0.87%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rusackas
Copy link
Member

rusackas commented Jul 9, 2024

Woohoo, CI is green!

useRedux: true,
});
render(
<MemoryRouter>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

render(<LeftPanel setDataset={mockFun} />, {
    useRedux: true,
    useRouter: true,
});

@@ -122,6 +123,9 @@ export default function LeftPanel({
datasetNames,
}: LeftPanelProps) {
const { addDangerToast } = useToasts();
const location = useLocation();

const isAddingDataSet = location.pathname.includes('/dataset/add') ?? false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the correct way of handling this case. This component receives the dataset as a parameter and it should be the responsibility of the caller to update the dataset accordingly, which will trigger a re-render of this component. If you check the call stack, you'll see the dataset is coming from a hook. We need to invalidate the cached results of that hook if the database changes. @justinpark

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see, i will check if i can patch a fix on the backend

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

Successfully merging this pull request may close these issues.

Database shows stale display name even after it has been changed
3 participants