sample data product links doesnt work when ı change theme .but works on luna theme
First, Magento does not recommend inheriting from the Luma theme. Magento only recommend inheriting from the blank theme.
You are not able to see sample data because sample data is currently linked to a specific theme Magento/luma.
For example, Go into the Admin > Content section, then look at a Footer Links widget added by sample data.
I hope you got your answer.