After Kraków had been devastated during the 1241 Mongol invasion of Poland, it was re-established according to Magdeburg Law by Prince Bolesław V the Chaste. In 1291 the Duchy of Kraków fell to the Přemyslid king Wenceslaus II of Bohemia who in 1300 also became King of Poland. Upon the extinction of the Přemyslids in 1306, the Piast duke Władysław I the Elbow-high assumed the rule at Kraków, while in 1310 the Bohemian Kingdom passed to the House of Luxembourg. The new king, John of Bohemia, continued to claim the Polish royal title and moreover sought to vassalize the Piast dukes of the adjacent Silesian region.
Question: What happened first, the invasion of Poland or the extinction of the Premyslids?
Answer: invasion of Poland