-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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/tasks edit #15549
Fix/tasks edit #15549
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work!
small nitpick (not worth blocking on), and a comment / question about skipping that reducer test. would just like a little clarification on that test :)
ui/src/tasks/reducers/tasks.test.ts
Outdated
@@ -5,7 +5,8 @@ import tasksReducer, { | |||
import {setTaskOption} from 'src/tasks/actions' | |||
import {TaskSchedule} from 'src/utils/taskOptionsToFluxScript' | |||
|
|||
describe('tasksReducer', () => { | |||
// skipping this test since the cron and interval values should not be reset when toggling between schedule tasks | |||
describe.skip('tasksReducer', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this asserts something that is no longer the case, or it represents outdated assumptions, i'd say just remove the whole assertion. i think keeping it around will be more confusing than helpful. i appreciate the hesitation to delete an entire file someone else wrote though :)
if we're not sure what this is supposed to do, let's get some clarification from russ.
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the sympathy - definitely didn't wanna go around deleting files and taking names my second week, but it doesn't seem applicable. The only reason why I'd want to keep it would be to have a basis for fleshing out tests on the reducer later on. I'll go ahead and fix the tests so that they're consistent with the new logic of not overwriting the previous values
… the issue where task form data didn't persist when toggling between schedule task options
…rrent reducer functionality and updated the parameter name for consistency
787ed97
to
579dbda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dude you're killing it with this PR!
LGTM! just cut that comment in the test before merging
ui/src/tasks/reducers/tasks.test.ts
Outdated
@@ -5,11 +5,13 @@ import tasksReducer, { | |||
import {setTaskOption} from 'src/tasks/actions' | |||
import {TaskSchedule} from 'src/utils/taskOptionsToFluxScript' | |||
|
|||
// skipping this test since the cron and interval values should not be reset when toggling between schedule tasks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✂️ this comment 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, good eyes!
Closes #15534
Problem
The page would crash whenever an existing task was selected to edit. In addition, data on the task form would not populate or persist whenever a task was selected to edit / was toggled between task
Solution
The app was originally failing because of a race condition where the
currentTask
that was needed to call thesetAllTaskOptions
was only being populate after the componentDidMount functionselectTaskByID
was triggered. Since they were both being triggered in the CDM lifecycle, thesetAllTaskOptions
would never actually populate the data. To solve this, I created a newsetAllTaskOptionsByID
to get the task data based on theid
.In doing so, this fixed our issue of data persistence in the
TaskForm
. To resolve the issue of data persistence when toggling betweenschedule tasks
simply required a modification to the following reducer:https://github.com/influxdata/influxdb/blob/master/ui/src/tasks/reducers/index.ts#L94
It seems like the original intent of this conditional was to prevent data persistence from mucking up the task (i.e. storing interval data and cron data may have set the data for both), but these fears seem unfounded since the data is set correctly without any unintended consequences.